metanorma-m3aawg 2.0.8 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -173,21 +173,18 @@
173
173
  </fo:block>
174
174
  <!-- Version 1.0 -->
175
175
  <fo:block font-size="12pt" margin-bottom="6pt">
176
- <xsl:variable name="title-edition">
177
- <xsl:call-template name="getTitle">
178
- <xsl:with-param name="name" select="'title-edition'"/>
176
+ <xsl:variable name="edition" select="normalize-space(/m3d:m3d-standard/m3d:bibdata/m3d:edition[normalize-space(@language) = ''])"/>
177
+ <xsl:if test="$edition != ''">
178
+ <xsl:call-template name="capitalize">
179
+ <xsl:with-param name="str">
180
+ <xsl:call-template name="getLocalizedString">
181
+ <xsl:with-param name="key">version</xsl:with-param>
182
+ </xsl:call-template>
183
+ </xsl:with-param>
179
184
  </xsl:call-template>
180
- </xsl:variable>
181
- <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
182
- <xsl:variable name="edition" select="/m3d:m3d-standard/m3d:bibdata/m3d:edition"/>
183
- <xsl:choose>
184
- <xsl:when test="contains($edition, '.')">
185
- <xsl:value-of select="$edition"/>
186
- </xsl:when>
187
- <xsl:otherwise>
188
- <xsl:value-of select="$edition"/><xsl:text>.0</xsl:text>
189
- </xsl:otherwise>
190
- </xsl:choose>
185
+ <xsl:text>: </xsl:text>
186
+ <xsl:value-of select="$edition"/><xsl:if test="not(contains($edition, '.'))"><xsl:text>.0</xsl:text></xsl:if>
187
+ </xsl:if>
191
188
  </fo:block>
192
189
  <fo:block font-size="12pt" margin-bottom="12pt">
193
190
  <xsl:call-template name="convertDate">
@@ -550,6 +547,7 @@
550
547
 
551
548
  <xsl:template match="m3d:p" name="paragraph">
552
549
  <xsl:param name="inline" select="'false'"/>
550
+ <xsl:param name="split_keep-within-line"/>
553
551
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
554
552
  <xsl:variable name="element-name">
555
553
  <xsl:choose>
@@ -570,7 +568,9 @@
570
568
  </xsl:attribute>
571
569
  <xsl:attribute name="text-indent">0mm</xsl:attribute>
572
570
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
573
- <xsl:apply-templates/>
571
+ <xsl:apply-templates>
572
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
573
+ </xsl:apply-templates>
574
574
  </xsl:element>
575
575
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
576
576
  <xsl:choose>
@@ -648,30 +648,45 @@
648
648
  </xsl:template>
649
649
 
650
650
 
651
-
652
- <xsl:template match="mathml:math" priority="2">
653
- <fo:inline font-family="Cambria Math">
654
- <xsl:variable name="mathml">
655
- <xsl:apply-templates select="." mode="mathml"/>
656
- </xsl:variable>
657
- <fo:instream-foreign-object fox:alt-text="Math">
658
- <!-- <xsl:copy-of select="."/> -->
659
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
660
- </fo:instream-foreign-object>
661
- </fo:inline>
662
- </xsl:template>
663
-
664
-
665
651
  <xsl:variable name="Image-M3AAWG-Logo">
666
652
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAjUAAAA8CAYAAACehUt5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA99pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5h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qN76jluyXlP1fznY/xgXEzqrCButblm2a1xcovbcdtD7QrPwUehc0OOM5l7cmeJtjA6k80mJnbrttzUXiDIMn1WHWVZsUgsYulYcr+7KXlhVZVjVTVElxpxphn6Vltqi9u0m9pgVWf5ey0/sTQYZBDfbXTdb1UI9tFbXdUyCwhX43GS4fKHV6wfDcXkTDOsI4byfPzq2B9pQqc9C9gVKnGxOWF24nYu5cUs1twmr59sCl/WjzU1MAHYIQWw2XqsLZRoRpOjVnMND+1qKFmae8wFgtsG2gHDly5KgAVF5e/pvffrJtf4yoCUBDsrlDD0jZnqdqAtAEtE9GzVJS12NpxxuqwnCspk7vvSewQplRk4CGffKrpLu4WsU2xFMqfgTkuIS+hrErAGQ7eV+RpBtsgMaRI0eOqpNswmSFMlscf1yDdZ5rqVfsk3NFkMJL4HkmbZYabCMMUYsM4wNDz3VFkKzUrNShVr7FUOZ9NShw35f64SwWk60P1I2fJiwW9gDQlGR1cGTSNv0gbYKhLrYvh9WWD5peZ3C5fFLqB3dI7HfDm2YPzqkkhzFChQ+bC2gOAdpwAOpSxzYdOXJUW8m8/VQPKGr7yVHdJbgdKy+GwcowwKvGOsCgFnZZy2jfUtv7DMAXtgDYy4dHFM5Yakzw/AsXBTBqhR3AXAaFzOI7nKfc9pMjR44KTNh+cmc/OaqTRBCxpIbrgO2dVXWoz6DF+ZLJkSNHjuodOZduR44cOXLkyJEDNY4cOXLkyJEjR7WF/O2nDbnvXd9oIzfEjhw5cuTI0W8L1CAA0DauOxw5clQA6khe84PrCkeOHBWS/l+AAQACYD7v73Ou8wAAAABJRU5ErkJggg==</xsl:text>
667
653
  </xsl:variable>
668
654
 
669
- <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">
655
+ <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_">
656
+ <xsl:for-each select="$table_widths_from_if//table">
657
+ <xsl:copy>
658
+ <xsl:copy-of select="@*"/>
659
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
660
+ </xsl:copy>
661
+ </xsl:for-each>
662
+ </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_">
663
+ false
664
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
670
665
  <xsl:call-template name="getLang"/>
671
- </xsl:variable><xsl:variable name="pageWidth_">
672
- 215.9
666
+ </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_">
667
+ <xsl:choose>
668
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
669
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
670
+ </xsl:choose>
671
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
672
+ <xsl:choose>
673
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
674
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
675
+ </xsl:choose>
676
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
677
+ <xsl:choose>
678
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
679
+ <xsl:otherwise>
680
+ 215.9
681
+ </xsl:otherwise>
682
+ </xsl:choose>
673
683
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
674
- 279.4
684
+ <xsl:choose>
685
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
686
+ <xsl:otherwise>
687
+ 279.4
688
+ </xsl:otherwise>
689
+ </xsl:choose>
675
690
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
676
691
  17.3
677
692
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -681,20 +696,7 @@
681
696
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
682
697
  23
683
698
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
684
-
685
- <title-edition lang="en">
686
-
687
- <xsl:text>Version</xsl:text>
688
-
689
- </title-edition>
690
699
 
691
- <title-edition lang="fr">
692
- <xsl:text>Édition </xsl:text>
693
- </title-edition>
694
-
695
- <title-edition lang="ru">
696
- <xsl:text>Издание </xsl:text>
697
- </title-edition>
698
700
 
699
701
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
700
702
  <title-toc lang="en">
@@ -775,7 +777,7 @@
775
777
  </xsl:variable><xsl:variable name="bibdata">
776
778
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
777
779
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
778
- </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">
780
+ </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">
779
781
  <xsl:param name="name"/>
780
782
  <xsl:param name="lang"/>
781
783
  <xsl:variable name="lang_">
@@ -823,7 +825,7 @@
823
825
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
824
826
 
825
827
  <xsl:variable name="additional_fonts_">
826
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
828
+ <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']">
827
829
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
828
830
  </xsl:for-each>
829
831
  </xsl:variable>
@@ -898,7 +900,6 @@
898
900
 
899
901
 
900
902
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
901
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
902
903
 
903
904
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
904
905
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -984,6 +985,7 @@
984
985
 
985
986
 
986
987
 
988
+
987
989
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
988
990
 
989
991
 
@@ -1136,6 +1138,7 @@
1136
1138
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1137
1139
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1138
1140
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1141
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1139
1142
  <xsl:attribute name="display-align">center</xsl:attribute>
1140
1143
 
1141
1144
 
@@ -1154,6 +1157,7 @@
1154
1157
  <xsl:attribute name="display-align">center</xsl:attribute>
1155
1158
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1156
1159
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1160
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1157
1161
 
1158
1162
 
1159
1163
 
@@ -1238,7 +1242,8 @@
1238
1242
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1239
1243
 
1240
1244
 
1241
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1245
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1246
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1242
1247
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1243
1248
 
1244
1249
 
@@ -1250,6 +1255,27 @@
1250
1255
 
1251
1256
 
1252
1257
 
1258
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1259
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1260
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1261
+
1262
+
1263
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1278
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1253
1279
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1254
1280
 
1255
1281
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1537,6 +1563,8 @@
1537
1563
  </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1538
1564
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1539
1565
 
1566
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
1567
+
1540
1568
 
1541
1569
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1542
1570
 
@@ -1559,6 +1587,24 @@
1559
1587
 
1560
1588
 
1561
1589
 
1590
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1591
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1592
+
1593
+
1594
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+
1605
+
1606
+
1607
+
1562
1608
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1563
1609
 
1564
1610
 
@@ -1952,13 +1998,13 @@
1952
1998
 
1953
1999
  </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">
1954
2000
  <xsl:variable name="nodes_preface_">
1955
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2001
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1956
2002
  <node id="{@id}"/>
1957
2003
  </xsl:for-each>
1958
2004
  </xsl:variable>
1959
2005
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
1960
2006
 
1961
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2007
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1962
2008
  <xsl:sort select="@displayorder" data-type="number"/>
1963
2009
 
1964
2010
  <!-- process Section's title -->
@@ -2024,7 +2070,7 @@
2024
2070
  </xsl:for-each>
2025
2071
  </figures>
2026
2072
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2027
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2073
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2028
2074
  <xsl:sort select="@displayorder" data-type="number"/>
2029
2075
  <xsl:apply-templates select="."/>
2030
2076
  </xsl:for-each>
@@ -2050,22 +2096,32 @@
2050
2096
  <xsl:sort select="@displayorder" data-type="number"/>
2051
2097
  <xsl:apply-templates select="."/>
2052
2098
  </xsl:for-each>
2053
- </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">
2054
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2055
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2056
- <xsl:call-template name="replace_fo_inline">
2057
- <xsl:with-param name="text" select="$text"/>
2058
- </xsl:call-template>
2059
- </xsl:template><xsl:template name="replace_fo_inline">
2099
+ </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">
2100
+
2101
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2102
+ <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))"/>
2103
+ <xsl:call-template name="replace_fo_inline_tags">
2104
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2105
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2106
+ <xsl:with-param name="text" select="$text"/>
2107
+ </xsl:call-template>
2108
+
2109
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2110
+ <xsl:param name="tag_open"/>
2111
+ <xsl:param name="tag_close"/>
2060
2112
  <xsl:param name="text"/>
2061
2113
  <xsl:choose>
2062
2114
  <xsl:when test="contains($text, $tag_open)">
2063
2115
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2064
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2116
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2065
2117
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2066
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2067
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2068
- <xsl:call-template name="replace_fo_inline">
2118
+ <fo:inline keep-together.within-line="always">
2119
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2120
+ </fo:inline>
2121
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2122
+ <xsl:call-template name="replace_fo_inline_tags">
2123
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2124
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2069
2125
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2070
2126
  </xsl:call-template>
2071
2127
  </xsl:when>
@@ -2073,6 +2129,39 @@
2073
2129
  </xsl:choose>
2074
2130
  </xsl:template><xsl:template match="*[local-name()='br']">
2075
2131
  <xsl:value-of select="$linebreak"/>
2132
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2133
+ <xsl:param name="split_keep-within-line"/>
2134
+
2135
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2136
+ <xsl:choose>
2137
+
2138
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2139
+ <xsl:variable name="sep">_</xsl:variable>
2140
+ <xsl:variable name="items">
2141
+ <xsl:call-template name="split">
2142
+ <xsl:with-param name="pText" select="."/>
2143
+ <xsl:with-param name="sep" select="$sep"/>
2144
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2145
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2146
+ </xsl:call-template>
2147
+ </xsl:variable>
2148
+ <xsl:for-each select="xalan:nodeset($items)/item">
2149
+ <xsl:choose>
2150
+ <xsl:when test=". = $sep">
2151
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2152
+ </xsl:when>
2153
+ <xsl:otherwise>
2154
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2155
+ </xsl:otherwise>
2156
+ </xsl:choose>
2157
+ </xsl:for-each>
2158
+ </xsl:when>
2159
+
2160
+ <xsl:otherwise>
2161
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2162
+ </xsl:otherwise>
2163
+
2164
+ </xsl:choose>
2076
2165
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2077
2166
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2078
2167
  <xsl:apply-templates/>
@@ -2138,8 +2227,23 @@
2138
2227
  </xsl:call-template>
2139
2228
 
2140
2229
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2141
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2142
- <xsl:call-template name="add-zero-spaces-java"/>
2230
+ <xsl:choose>
2231
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2232
+ <xsl:value-of select="."/>
2233
+ </xsl:when>
2234
+ <xsl:otherwise>
2235
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2236
+ </xsl:otherwise>
2237
+ </xsl:choose>
2238
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2239
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2240
+ <!-- <xsl:copy-of select="$text"/> -->
2241
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2242
+ <xsl:choose>
2243
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2244
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2245
+ </xsl:choose>
2246
+ </xsl:for-each>
2143
2247
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2144
2248
 
2145
2249
  <xsl:variable name="table-preamble">
@@ -2149,9 +2253,14 @@
2149
2253
 
2150
2254
  <xsl:variable name="table">
2151
2255
 
2152
- <xsl:variable name="simple-table">
2153
- <xsl:call-template name="getSimpleTable"/>
2256
+ <xsl:variable name="simple-table">
2257
+ <xsl:call-template name="getSimpleTable">
2258
+ <xsl:with-param name="id" select="@id"/>
2259
+ </xsl:call-template>
2154
2260
  </xsl:variable>
2261
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2262
+
2263
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2155
2264
 
2156
2265
 
2157
2266
  <!-- Display table's name before table as standalone block -->
@@ -2174,7 +2283,23 @@
2174
2283
  </xsl:call-template>
2175
2284
  </xsl:if>
2176
2285
  </xsl:variable>
2177
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2286
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2287
+
2288
+ <!-- DEBUG -->
2289
+ <xsl:if test="$table_if_debug = 'true'">
2290
+ <fo:block font-size="60%">
2291
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2292
+ </fo:block>
2293
+ </xsl:if>
2294
+
2295
+
2296
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2297
+
2298
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2299
+ DEBUG
2300
+ colwidths=<xsl:copy-of select="$colwidths"/>
2301
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2302
+
2178
2303
 
2179
2304
 
2180
2305
  <xsl:variable name="margin-side">
@@ -2241,9 +2366,17 @@
2241
2366
  </xsl:element>
2242
2367
  </xsl:variable>
2243
2368
 
2369
+ <xsl:if test="$isGenerateTableIF = 'true'">
2370
+ <!-- to determine start of table -->
2371
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2372
+ </xsl:if>
2244
2373
 
2245
2374
  <fo:table id="{@id}">
2246
2375
 
2376
+ <xsl:if test="$isGenerateTableIF = 'true'">
2377
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2378
+ </xsl:if>
2379
+
2247
2380
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2248
2381
  <xsl:attribute name="{local-name()}">
2249
2382
  <xsl:value-of select="."/>
@@ -2257,31 +2390,47 @@
2257
2390
 
2258
2391
 
2259
2392
  <xsl:choose>
2260
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2261
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2262
- <fo:table-column column-width="{@width}"/>
2263
- </xsl:for-each>
2393
+ <xsl:when test="$isGenerateTableIF = 'true'">
2394
+ <!-- generate IF for table widths -->
2395
+ <!-- example:
2396
+ <tr>
2397
+ <td valign="top" align="left" id="tab-symdu_1_1">
2398
+ <p>Symbol</p>
2399
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2400
+ </td>
2401
+ <td valign="top" align="left" id="tab-symdu_1_2">
2402
+ <p>Description</p>
2403
+ <word id="tab-symdu_1_2_word_1">Description</word>
2404
+ </td>
2405
+ </tr>
2406
+ -->
2407
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2408
+
2264
2409
  </xsl:when>
2265
2410
  <xsl:otherwise>
2266
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2267
- <xsl:choose>
2268
- <xsl:when test=". = 1 or . = 0">
2269
- <fo:table-column column-width="proportional-column-width(2)"/>
2270
- </xsl:when>
2271
- <xsl:otherwise>
2272
- <fo:table-column column-width="proportional-column-width({.})"/>
2273
- </xsl:otherwise>
2274
- </xsl:choose>
2275
- </xsl:for-each>
2276
- </xsl:otherwise>
2277
- </xsl:choose>
2278
2411
 
2279
- <xsl:choose>
2280
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2281
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2282
- </xsl:when>
2283
- <xsl:otherwise>
2284
- <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 -->
2412
+ <xsl:choose>
2413
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2414
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2415
+ <fo:table-column column-width="{@width}"/>
2416
+ </xsl:for-each>
2417
+ </xsl:when>
2418
+ <xsl:otherwise>
2419
+ <xsl:call-template name="insertTableColumnWidth">
2420
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2421
+ </xsl:call-template>
2422
+ </xsl:otherwise>
2423
+ </xsl:choose>
2424
+
2425
+ <xsl:choose>
2426
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2427
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2428
+ </xsl:when>
2429
+ <xsl:otherwise>
2430
+ <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 -->
2431
+ </xsl:otherwise>
2432
+ </xsl:choose>
2433
+
2285
2434
  </xsl:otherwise>
2286
2435
  </xsl:choose>
2287
2436
 
@@ -2384,11 +2533,22 @@
2384
2533
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2385
2534
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2386
2535
  </xsl:template><xsl:template name="calculate-column-widths">
2536
+ <xsl:param name="table"/>
2537
+ <xsl:param name="cols-count"/>
2538
+
2539
+ <xsl:call-template name="calculate-column-widths-proportional">
2540
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2541
+ <xsl:with-param name="table" select="$table"/>
2542
+ </xsl:call-template>
2543
+
2544
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2387
2545
  <xsl:param name="table"/>
2388
2546
  <xsl:param name="cols-count"/>
2389
2547
  <xsl:param name="curr-col" select="1"/>
2390
2548
  <xsl:param name="width" select="0"/>
2391
2549
 
2550
+ <!-- table=<xsl:copy-of select="$table"/> -->
2551
+
2392
2552
  <xsl:if test="$curr-col &lt;= $cols-count">
2393
2553
  <xsl:variable name="widths">
2394
2554
  <xsl:choose>
@@ -2426,16 +2586,22 @@
2426
2586
  </xsl:for-each>
2427
2587
  </xsl:when>
2428
2588
  <xsl:otherwise>
2429
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2589
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2590
+
2591
+ <!-- <table><xsl:copy-of select="$table"/></table>
2592
+ -->
2593
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2430
2594
  <xsl:variable name="td_text">
2431
2595
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2432
2596
  </xsl:variable>
2597
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2433
2598
  <xsl:variable name="words">
2434
2599
  <xsl:variable name="string_with_added_zerospaces">
2435
2600
  <xsl:call-template name="add-zero-spaces-java">
2436
2601
  <xsl:with-param name="text" select="$td_text"/>
2437
2602
  </xsl:call-template>
2438
2603
  </xsl:variable>
2604
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2439
2605
  <xsl:call-template name="tokenize">
2440
2606
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2441
2607
  <!-- 2009 thinspace -->
@@ -2443,11 +2609,13 @@
2443
2609
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2444
2610
  </xsl:call-template>
2445
2611
  </xsl:variable>
2612
+ <!-- words=<xsl:copy-of select="$words"/> -->
2446
2613
  <xsl:variable name="max_length">
2447
2614
  <xsl:call-template name="max_length">
2448
2615
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2449
2616
  </xsl:call-template>
2450
2617
  </xsl:variable>
2618
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2451
2619
  <width>
2452
2620
  <xsl:variable name="divider">
2453
2621
  <xsl:choose>
@@ -2466,6 +2634,8 @@
2466
2634
  </xsl:choose>
2467
2635
  </xsl:variable>
2468
2636
 
2637
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2638
+
2469
2639
  <column>
2470
2640
  <xsl:for-each select="xalan:nodeset($widths)//width">
2471
2641
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2474,29 +2644,271 @@
2474
2644
  </xsl:if>
2475
2645
  </xsl:for-each>
2476
2646
  </column>
2477
- <xsl:call-template name="calculate-column-widths">
2647
+ <xsl:call-template name="calculate-column-widths-proportional">
2478
2648
  <xsl:with-param name="cols-count" select="$cols-count"/>
2479
2649
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2480
2650
  <xsl:with-param name="table" select="$table"/>
2481
2651
  </xsl:call-template>
2482
2652
  </xsl:if>
2653
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2654
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2655
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2656
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2657
+
2658
+ <!-- if all capitals english letters or digits -->
2659
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2660
+ <xsl:call-template name="repeat">
2661
+ <xsl:with-param name="char" select="'X'"/>
2662
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2663
+ </xsl:call-template>
2664
+ </xsl:if>
2483
2665
  </xsl:template><xsl:template match="text()" mode="td_text">
2484
2666
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2485
2667
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2486
2668
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2487
2669
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2488
2670
  <xsl:value-of select="@target"/>
2489
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2490
- <xsl:variable name="mathml">
2491
- <xsl:for-each select="*">
2492
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2493
- <xsl:copy-of select="."/>
2494
- </xsl:if>
2671
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2672
+ <xsl:if test="$isGenerateTableIF = 'false'">
2673
+ <xsl:variable name="mathml_">
2674
+ <xsl:for-each select="*">
2675
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2676
+ <xsl:copy-of select="."/>
2677
+ </xsl:if>
2678
+ </xsl:for-each>
2679
+ </xsl:variable>
2680
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2681
+
2682
+ <xsl:variable name="math_text">
2683
+ <xsl:value-of select="normalize-space($mathml)"/>
2684
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2685
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2686
+ </xsl:variable>
2687
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2688
+ </xsl:if>
2689
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2690
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2691
+
2692
+ <!-- via intermediate format -->
2693
+
2694
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2695
+
2696
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2697
+
2698
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2699
+
2700
+ <!-- get current table id -->
2701
+ <xsl:variable name="table_id" select="@id"/>
2702
+ <!-- find table by id in the file 'table_widths' -->
2703
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2704
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2705
+
2706
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2707
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2708
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2709
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2710
+
2711
+ <xsl:variable name="table_with_cell_widths_">
2712
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2713
+ </xsl:variable>
2714
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2715
+
2716
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2717
+ <xsl:copy-of select="$table_with_cell_widths"/>
2718
+ </xsl:if> -->
2719
+
2720
+
2721
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2722
+
2723
+ <xsl:variable name="column_widths_">
2724
+ <!-- iteration of columns -->
2725
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2726
+ <xsl:variable name="pos" select="position()"/>
2727
+ <column>
2728
+ <xsl:attribute name="width_max">
2729
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2730
+ <xsl:sort select="." data-type="number" order="descending"/>
2731
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2732
+ </xsl:for-each>
2733
+ </xsl:attribute>
2734
+ <xsl:attribute name="width_min">
2735
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2736
+ <xsl:sort select="." data-type="number" order="descending"/>
2737
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2738
+ </xsl:for-each>
2739
+ </xsl:attribute>
2740
+ </column>
2495
2741
  </xsl:for-each>
2496
2742
  </xsl:variable>
2743
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2744
+
2745
+ <!-- <column_widths>
2746
+ <xsl:copy-of select="$column_widths"/>
2747
+ </column_widths> -->
2748
+
2749
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2750
+ <xsl:variable name="table_widths_">
2751
+ <table>
2752
+ <xsl:attribute name="width_max">
2753
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2754
+ </xsl:attribute>
2755
+ <xsl:attribute name="width_min">
2756
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2757
+ </xsl:attribute>
2758
+ </table>
2759
+ </xsl:variable>
2760
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2761
+
2762
+ <xsl:variable name="page_width">
2763
+ <xsl:choose>
2764
+ <xsl:when test="$parent_table_page-width != ''">
2765
+ <xsl:value-of select="$parent_table_page-width"/>
2766
+ </xsl:when>
2767
+ <xsl:otherwise>
2768
+ <xsl:value-of select="@page-width"/>
2769
+ </xsl:otherwise>
2770
+ </xsl:choose>
2771
+ </xsl:variable>
2772
+
2773
+ <xsl:if test="$table_if_debug = 'true'">
2774
+ <table_width>
2775
+ <xsl:copy-of select="$table_widths"/>
2776
+ </table_width>
2777
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2778
+ </xsl:if>
2779
+
2780
+
2781
+ <!-- There are three cases: -->
2782
+ <xsl:choose>
2783
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2784
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2785
+ <!-- call old algorithm -->
2786
+ <case1/>
2787
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2788
+ <xsl:call-template name="calculate-column-widths-proportional">
2789
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2790
+ <xsl:with-param name="table" select="$table"/>
2791
+ </xsl:call-template> -->
2792
+ </xsl:when>
2793
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2794
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2795
+ <case2/>
2796
+ <autolayout/>
2797
+ <xsl:for-each select="$column_widths/column/@width_max">
2798
+ <column divider="100"><xsl:value-of select="."/></column>
2799
+ </xsl:for-each>
2800
+ </xsl:when>
2801
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2802
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2803
+ Lets also call D the difference between maximum and minimum width of the table.
2804
+ For each column, let d be the difference between maximum and minimum width of that column.
2805
+ Now set the column's width to the minimum width plus d times W over D.
2806
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2807
+ <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)">
2808
+ <!-- difference between the available space and the minimum table width -->
2809
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2810
+ <W><xsl:value-of select="$W"/></W>
2811
+ <!-- difference between maximum and minimum width of the table -->
2812
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2813
+ <D><xsl:value-of select="$D"/></D>
2814
+ <case3/>
2815
+ <autolayout/>
2816
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2817
+ <split_keep-within-line>true</split_keep-within-line>
2818
+ </xsl:if>
2819
+ <xsl:for-each select="$column_widths/column">
2820
+ <!-- difference between maximum and minimum width of that column. -->
2821
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2822
+ <d><xsl:value-of select="$d"/></d>
2823
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2824
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2825
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2826
+ <column divider="100">
2827
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2828
+ </column>
2829
+ </xsl:for-each>
2830
+
2831
+ </xsl:when>
2832
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2833
+ </xsl:choose>
2834
+
2835
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
2836
+
2837
+ <!-- if nested 'dl' or 'table' -->
2838
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
2839
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
2840
+
2841
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2842
+
2843
+ <xsl:variable name="parent_table_page-width_">
2844
+ <xsl:if test="$parent_table_id != ''">
2845
+ <!-- determine column number in the parent table -->
2846
+ <xsl:variable name="parent_table_column_number">
2847
+ <xsl:choose>
2848
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2849
+ <xsl:otherwise> <!-- parent is table -->
2850
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2851
+ </xsl:otherwise>
2852
+ </xsl:choose>
2853
+ </xsl:variable>
2854
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2855
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2856
+ </xsl:if>
2857
+ </xsl:variable>
2858
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2859
+
2860
+ <!-- get current table id -->
2861
+ <xsl:variable name="table_id" select="@id"/>
2862
+
2863
+ <xsl:choose>
2864
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
2865
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
2866
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
2867
+ </xsl:when>
2868
+ <xsl:otherwise>
2869
+ <!-- recalculate columns width based on parent table width -->
2870
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
2871
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
2872
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
2873
+ </xsl:call-template>
2874
+ </xsl:for-each>
2875
+ </xsl:otherwise>
2876
+ </xsl:choose>
2497
2877
 
2498
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2499
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2878
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
2879
+ <xsl:copy>
2880
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2881
+ </xsl:copy>
2882
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
2883
+ <xsl:copy>
2884
+ <xsl:copy-of select="@*"/>
2885
+
2886
+ <!-- The maximum width is given by the widest line. -->
2887
+ <xsl:attribute name="width_max">
2888
+ <xsl:for-each select="p_len">
2889
+ <xsl:sort select="." data-type="number" order="descending"/>
2890
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2891
+ </xsl:for-each>
2892
+ </xsl:attribute>
2893
+
2894
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2895
+ <xsl:variable name="width_min">
2896
+ <xsl:for-each select="word_len">
2897
+ <xsl:sort select="." data-type="number" order="descending"/>
2898
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2899
+ </xsl:for-each>
2900
+ </xsl:variable>
2901
+ <xsl:attribute name="width_min">
2902
+ <xsl:value-of select="$width_min"/>
2903
+ </xsl:attribute>
2904
+
2905
+ <xsl:if test="$width_min = 0">
2906
+ <xsl:attribute name="width_min">1</xsl:attribute>
2907
+ </xsl:if>
2908
+
2909
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
2910
+
2911
+ </xsl:copy>
2500
2912
  </xsl:template><xsl:template match="*[local-name()='thead']">
2501
2913
  <xsl:param name="cols-count"/>
2502
2914
  <fo:table-header>
@@ -2581,16 +2993,10 @@
2581
2993
  </xsl:for-each>
2582
2994
  </xsl:when>
2583
2995
  <xsl:otherwise>
2584
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2585
- <xsl:choose>
2586
- <xsl:when test=". = 1 or . = 0">
2587
- <fo:table-column column-width="proportional-column-width(2)"/>
2588
- </xsl:when>
2589
- <xsl:otherwise>
2590
- <fo:table-column column-width="proportional-column-width({.})"/>
2591
- </xsl:otherwise>
2592
- </xsl:choose>
2593
- </xsl:for-each>
2996
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2997
+ <xsl:call-template name="insertTableColumnWidth">
2998
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2999
+ </xsl:call-template>
2594
3000
  </xsl:otherwise>
2595
3001
  </xsl:choose>
2596
3002
 
@@ -2667,7 +3073,53 @@
2667
3073
 
2668
3074
  </fo:table-body>
2669
3075
 
2670
- </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3076
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3077
+ <xsl:param name="table_or_dl">table</xsl:param>
3078
+ <xsl:apply-templates mode="process_table-if">
3079
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3080
+ </xsl:apply-templates>
3081
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3082
+ <xsl:param name="table_or_dl">table</xsl:param>
3083
+
3084
+ <fo:table-body>
3085
+ <xsl:for-each select="*[local-name() = 'tr']">
3086
+ <xsl:variable name="col_count" select="count(*)"/>
3087
+
3088
+ <!-- iteration for each tr/td -->
3089
+
3090
+ <xsl:choose>
3091
+ <xsl:when test="$table_or_dl = 'table'">
3092
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3093
+ <fo:table-row number-columns-spanned="{$col_count}">
3094
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3095
+ <xsl:call-template name="td"/>
3096
+ </fo:table-row>
3097
+ </xsl:for-each>
3098
+ </xsl:when>
3099
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3100
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3101
+ <xsl:variable name="is_dt" select="position() = 1"/>
3102
+
3103
+ <xsl:for-each select="*">
3104
+ <!-- <test><xsl:copy-of select="."/></test> -->
3105
+ <fo:table-row number-columns-spanned="{$col_count}">
3106
+ <xsl:choose>
3107
+ <xsl:when test="$is_dt">
3108
+ <xsl:call-template name="insert_dt_cell"/>
3109
+ </xsl:when>
3110
+ <xsl:otherwise>
3111
+ <xsl:call-template name="insert_dd_cell"/>
3112
+ </xsl:otherwise>
3113
+ </xsl:choose>
3114
+ </fo:table-row>
3115
+ </xsl:for-each>
3116
+ </xsl:for-each>
3117
+ </xsl:otherwise>
3118
+ </xsl:choose>
3119
+
3120
+ </xsl:for-each>
3121
+ </fo:table-body>
3122
+ </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2671
3123
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2672
3124
 
2673
3125
 
@@ -2753,7 +3205,7 @@
2753
3205
  </xsl:choose>
2754
3206
  </xsl:attribute>
2755
3207
  </xsl:if>
2756
- </xsl:template><xsl:template match="*[local-name()='td']">
3208
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2757
3209
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2758
3210
  <xsl:call-template name="setTextAlignment">
2759
3211
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2787,11 +3239,24 @@
2787
3239
 
2788
3240
  <xsl:call-template name="setTableCellAttributes"/>
2789
3241
 
3242
+ <xsl:if test="$isGenerateTableIF = 'true'">
3243
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3244
+ <xsl:attribute name="text-align">left</xsl:attribute>
3245
+ </xsl:if>
3246
+
2790
3247
  <fo:block>
2791
3248
 
3249
+ <xsl:if test="$isGenerateTableIF = 'true'">
3250
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3251
+ </xsl:if>
3252
+
3253
+
2792
3254
 
2793
3255
 
2794
3256
  <xsl:apply-templates/>
3257
+
3258
+ <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"/> -->
3259
+
2795
3260
  </fo:block>
2796
3261
  </fo:table-cell>
2797
3262
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -2988,9 +3453,9 @@
2988
3453
  <!-- current hierarchy is 'figure' element -->
2989
3454
  <xsl:variable name="following_dl_colwidths">
2990
3455
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2991
- <xsl:variable name="html-table">
2992
- <xsl:variable name="doc_ns">
2993
-
3456
+ <xsl:variable name="simple-table">
3457
+ <!-- <xsl:variable name="doc_ns">
3458
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
2994
3459
  </xsl:variable>
2995
3460
  <xsl:variable name="ns">
2996
3461
  <xsl:choose>
@@ -3001,7 +3466,7 @@
3001
3466
  <xsl:value-of select="substring-before(name(/*), '-')"/>
3002
3467
  </xsl:otherwise>
3003
3468
  </xsl:choose>
3004
- </xsl:variable>
3469
+ </xsl:variable> -->
3005
3470
 
3006
3471
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3007
3472
  <tbody>
@@ -3012,7 +3477,7 @@
3012
3477
 
3013
3478
  <xsl:call-template name="calculate-column-widths">
3014
3479
  <xsl:with-param name="cols-count" select="2"/>
3015
- <xsl:with-param name="table" select="$html-table"/>
3480
+ <xsl:with-param name="table" select="$simple-table"/>
3016
3481
  </xsl:call-template>
3017
3482
 
3018
3483
  </xsl:if>
@@ -3131,8 +3596,10 @@
3131
3596
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3132
3597
  </xsl:variable>
3133
3598
 
3599
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3600
+
3134
3601
  <xsl:choose>
3135
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3602
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3136
3603
 
3137
3604
  <fo:block margin-bottom="12pt" text-align="left">
3138
3605
 
@@ -3147,7 +3614,7 @@
3147
3614
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3148
3615
  </fo:block>
3149
3616
 
3150
- </xsl:when>
3617
+ </xsl:when> <!-- END: only one component -->
3151
3618
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3152
3619
  <fo:block margin-bottom="12pt" text-align="left">
3153
3620
 
@@ -3161,8 +3628,8 @@
3161
3628
  </xsl:variable>
3162
3629
  <xsl:value-of select="$title-where"/>
3163
3630
  </fo:block>
3164
- </xsl:when>
3165
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3631
+ </xsl:when> <!-- END: a few components -->
3632
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3166
3633
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3167
3634
 
3168
3635
 
@@ -3175,22 +3642,41 @@
3175
3642
  </xsl:variable>
3176
3643
  <xsl:value-of select="$title-key"/>
3177
3644
  </fo:block>
3178
- </xsl:when>
3645
+ </xsl:when> <!-- END: definition list in a figure -->
3179
3646
  </xsl:choose>
3180
3647
 
3181
3648
  <!-- a few components -->
3182
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3649
+ <xsl:if test="$onlyOneComponent = 'false'">
3183
3650
  <fo:block>
3184
3651
 
3185
3652
 
3186
3653
 
3187
3654
 
3655
+
3656
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3657
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3658
+ </xsl:if>
3659
+
3188
3660
  <fo:block>
3189
3661
 
3190
3662
 
3191
3663
 
3192
3664
 
3665
+ <xsl:apply-templates select="*[local-name() = 'name']">
3666
+ <xsl:with-param name="process">true</xsl:with-param>
3667
+ </xsl:apply-templates>
3668
+
3669
+ <xsl:if test="$isGenerateTableIF = 'true'">
3670
+ <!-- to determine start of table -->
3671
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3672
+ </xsl:if>
3673
+
3193
3674
  <fo:table width="95%" table-layout="fixed">
3675
+
3676
+ <xsl:if test="$isGenerateTableIF = 'true'">
3677
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3678
+ </xsl:if>
3679
+
3194
3680
 
3195
3681
  <xsl:choose>
3196
3682
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3199,61 +3685,178 @@
3199
3685
 
3200
3686
  </xsl:when>
3201
3687
  </xsl:choose>
3202
- <!-- create virtual html table for dl/[dt and dd] -->
3203
- <xsl:variable name="html-table">
3204
- <xsl:variable name="doc_ns">
3688
+
3689
+
3690
+
3691
+ <xsl:choose>
3692
+ <xsl:when test="$isGenerateTableIF = 'true'">
3693
+ <!-- generate IF for table widths -->
3694
+ <!-- example:
3695
+ <tr>
3696
+ <td valign="top" align="left" id="tab-symdu_1_1">
3697
+ <p>Symbol</p>
3698
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3699
+ </td>
3700
+ <td valign="top" align="left" id="tab-symdu_1_2">
3701
+ <p>Description</p>
3702
+ <word id="tab-symdu_1_2_word_1">Description</word>
3703
+ </td>
3704
+ </tr>
3705
+ -->
3205
3706
 
3206
- </xsl:variable>
3207
- <xsl:variable name="ns">
3208
- <xsl:choose>
3209
- <xsl:when test="normalize-space($doc_ns) != ''">
3210
- <xsl:value-of select="normalize-space($doc_ns)"/>
3211
- </xsl:when>
3212
- <xsl:otherwise>
3213
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3214
- </xsl:otherwise>
3215
- </xsl:choose>
3216
- </xsl:variable>
3217
- <tbody>
3218
- <xsl:apply-templates mode="dl"/>
3219
- </tbody>
3220
- </xsl:variable>
3221
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3222
- <xsl:variable name="colwidths">
3223
- <xsl:call-template name="calculate-column-widths">
3224
- <xsl:with-param name="cols-count" select="2"/>
3225
- <xsl:with-param name="table" select="$html-table"/>
3226
- </xsl:call-template>
3227
- </xsl:variable>
3228
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3229
- <xsl:variable name="maxlength_dt">
3230
- <xsl:call-template name="getMaxLength_dt"/>
3231
- </xsl:variable>
3232
- <xsl:call-template name="setColumnWidth_dl">
3233
- <xsl:with-param name="colwidths" select="$colwidths"/>
3234
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3235
- </xsl:call-template>
3236
- <fo:table-body>
3237
- <xsl:apply-templates>
3238
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3239
- </xsl:apply-templates>
3240
- </fo:table-body>
3707
+ <!-- create virtual html table for dl/[dt and dd] -->
3708
+ <xsl:variable name="simple-table">
3709
+
3710
+ <xsl:variable name="dl_table">
3711
+ <tbody>
3712
+ <xsl:apply-templates mode="dl_if">
3713
+ <xsl:with-param name="id" select="@id"/>
3714
+ </xsl:apply-templates>
3715
+ </tbody>
3716
+ </xsl:variable>
3717
+
3718
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3719
+
3720
+ <!-- Step: replace <br/> to <p>...</p> -->
3721
+ <xsl:variable name="table_without_br">
3722
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3723
+ </xsl:variable>
3724
+
3725
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3726
+
3727
+ <!-- Step: add id to each cell -->
3728
+ <!-- add <word>...</word> for each word, image, math -->
3729
+ <xsl:variable name="simple-table-id">
3730
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3731
+ <xsl:with-param name="id" select="@id"/>
3732
+ </xsl:apply-templates>
3733
+ </xsl:variable>
3734
+
3735
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3736
+
3737
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3738
+
3739
+ </xsl:variable>
3740
+
3741
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3742
+
3743
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3744
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3745
+ </xsl:apply-templates>
3746
+
3747
+ </xsl:when>
3748
+ <xsl:otherwise>
3749
+
3750
+ <xsl:variable name="simple-table">
3751
+
3752
+ <xsl:variable name="dl_table">
3753
+ <tbody>
3754
+ <xsl:apply-templates mode="dl">
3755
+ <xsl:with-param name="id" select="@id"/>
3756
+ </xsl:apply-templates>
3757
+ </tbody>
3758
+ </xsl:variable>
3759
+
3760
+ <xsl:copy-of select="$dl_table"/>
3761
+ </xsl:variable>
3762
+
3763
+ <xsl:variable name="colwidths">
3764
+ <xsl:call-template name="calculate-column-widths">
3765
+ <xsl:with-param name="cols-count" select="2"/>
3766
+ <xsl:with-param name="table" select="$simple-table"/>
3767
+ </xsl:call-template>
3768
+ </xsl:variable>
3769
+
3770
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3771
+ DEBUG
3772
+ colwidths=<xsl:copy-of select="$colwidths"/>
3773
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3774
+
3775
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3776
+
3777
+ <xsl:variable name="maxlength_dt">
3778
+ <xsl:call-template name="getMaxLength_dt"/>
3779
+ </xsl:variable>
3780
+
3781
+ <xsl:variable name="isContainsKeepTogetherTag_">
3782
+ false
3783
+ </xsl:variable>
3784
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3785
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3786
+
3787
+
3788
+ <xsl:call-template name="setColumnWidth_dl">
3789
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3790
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3791
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3792
+ </xsl:call-template>
3793
+
3794
+ <fo:table-body>
3795
+
3796
+ <!-- DEBUG -->
3797
+ <xsl:if test="$table_if_debug = 'true'">
3798
+ <fo:table-row>
3799
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3800
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3801
+ </fo:table-cell>
3802
+ </fo:table-row>
3803
+ </xsl:if>
3804
+
3805
+ <xsl:apply-templates>
3806
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3807
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3808
+ </xsl:apply-templates>
3809
+
3810
+ </fo:table-body>
3811
+ </xsl:otherwise>
3812
+ </xsl:choose>
3241
3813
  </fo:table>
3242
3814
  </fo:block>
3243
3815
  </fo:block>
3244
- </xsl:if>
3816
+ </xsl:if> <!-- END: a few components -->
3245
3817
  </fo:block-container>
3246
3818
  </fo:block-container>
3819
+
3820
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
3821
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
3822
+ </xsl:if>
3823
+
3824
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3825
+ <xsl:param name="process">false</xsl:param>
3826
+ <xsl:if test="$process = 'true'">
3827
+ <fo:block xsl:use-attribute-sets="dl-name-style">
3828
+ <xsl:apply-templates/>
3829
+ </fo:block>
3830
+ </xsl:if>
3247
3831
  </xsl:template><xsl:template name="setColumnWidth_dl">
3248
3832
  <xsl:param name="colwidths"/>
3249
3833
  <xsl:param name="maxlength_dt"/>
3834
+ <xsl:param name="isContainsKeepTogetherTag"/>
3835
+
3836
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3837
+
3250
3838
  <xsl:choose>
3839
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3840
+ <xsl:call-template name="insertTableColumnWidth">
3841
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3842
+ </xsl:call-template>
3843
+ </xsl:when>
3251
3844
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3252
3845
  <fo:table-column column-width="50%"/>
3253
3846
  <fo:table-column column-width="50%"/>
3254
3847
  </xsl:when>
3255
3848
  <xsl:otherwise>
3256
3849
  <xsl:choose>
3850
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3851
+ <xsl:call-template name="insertTableColumnWidth">
3852
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3853
+ </xsl:call-template>
3854
+ </xsl:when>
3855
+ <xsl:when test="$isContainsKeepTogetherTag">
3856
+ <xsl:call-template name="insertTableColumnWidth">
3857
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3858
+ </xsl:call-template>
3859
+ </xsl:when>
3257
3860
  <!-- to set width check most wide chars like `W` -->
3258
3861
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3259
3862
  <fo:table-column column-width="7%"/>
@@ -3284,20 +3887,31 @@
3284
3887
  <fo:table-column column-width="60%"/>
3285
3888
  </xsl:when>
3286
3889
  <xsl:otherwise>
3287
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3288
- <xsl:choose>
3289
- <xsl:when test=". = 1 or . = 0">
3290
- <fo:table-column column-width="proportional-column-width(2)"/>
3291
- </xsl:when>
3292
- <xsl:otherwise>
3293
- <fo:table-column column-width="proportional-column-width({.})"/>
3294
- </xsl:otherwise>
3295
- </xsl:choose>
3296
- </xsl:for-each>
3890
+ <xsl:call-template name="insertTableColumnWidth">
3891
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3892
+ </xsl:call-template>
3297
3893
  </xsl:otherwise>
3298
3894
  </xsl:choose>
3299
3895
  </xsl:otherwise>
3300
3896
  </xsl:choose>
3897
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3898
+ <xsl:param name="colwidths"/>
3899
+
3900
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3901
+ <xsl:choose>
3902
+ <xsl:when test=". = 1 or . = 0">
3903
+ <fo:table-column column-width="proportional-column-width(2)"/>
3904
+ </xsl:when>
3905
+ <xsl:otherwise>
3906
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
3907
+ <xsl:variable name="divider">
3908
+ <xsl:value-of select="@divider"/>
3909
+ <xsl:if test="not(@divider)">1</xsl:if>
3910
+ </xsl:variable>
3911
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3912
+ </xsl:otherwise>
3913
+ </xsl:choose>
3914
+ </xsl:for-each>
3301
3915
  </xsl:template><xsl:template name="getMaxLength_dt">
3302
3916
  <xsl:variable name="lengths">
3303
3917
  <xsl:for-each select="*[local-name()='dt']">
@@ -3321,7 +3935,6 @@
3321
3935
  <xsl:value-of select="$maxLength"/>
3322
3936
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3323
3937
  <xsl:param name="key_iso"/>
3324
-
3325
3938
  <!-- <tr>
3326
3939
  <td>NOTE</td>
3327
3940
  <td>
@@ -3329,27 +3942,47 @@
3329
3942
  </td>
3330
3943
  </tr>
3331
3944
  -->
3332
- <fo:table-row>
3945
+ <!-- OLD Variant -->
3946
+ <!-- <fo:table-row>
3333
3947
  <fo:table-cell>
3334
3948
  <fo:block margin-top="6pt">
3335
3949
  <xsl:if test="normalize-space($key_iso) = 'true'">
3336
3950
  <xsl:attribute name="margin-top">0</xsl:attribute>
3337
3951
  </xsl:if>
3338
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3952
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3339
3953
  </fo:block>
3340
3954
  </fo:table-cell>
3341
3955
  <fo:table-cell>
3342
3956
  <fo:block>
3343
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3957
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3958
+ </fo:block>
3959
+ </fo:table-cell>
3960
+ </fo:table-row> -->
3961
+ <!-- <tr>
3962
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3963
+ </tr>
3964
+ -->
3965
+ <fo:table-row>
3966
+ <fo:table-cell number-columns-spanned="2">
3967
+ <fo:block>
3968
+ <xsl:call-template name="note"/>
3344
3969
  </fo:block>
3345
3970
  </fo:table-cell>
3346
3971
  </fo:table-row>
3347
3972
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3973
+ <xsl:param name="id"/>
3974
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3348
3975
  <tr>
3349
3976
  <td>
3977
+ <xsl:attribute name="id">
3978
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
3979
+ </xsl:attribute>
3350
3980
  <xsl:apply-templates/>
3351
3981
  </td>
3352
3982
  <td>
3983
+ <xsl:attribute name="id">
3984
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
3985
+ </xsl:attribute>
3353
3986
 
3354
3987
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3355
3988
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3360,50 +3993,134 @@
3360
3993
 
3361
3994
  </xsl:template><xsl:template match="*[local-name()='dt']">
3362
3995
  <xsl:param name="key_iso"/>
3996
+ <xsl:param name="split_keep-within-line"/>
3363
3997
 
3364
3998
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3365
- <fo:table-cell>
3999
+ <xsl:call-template name="insert_dt_cell">
4000
+ <xsl:with-param name="key_iso" select="$key_iso"/>
4001
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4002
+ </xsl:call-template>
4003
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
4004
+ <xsl:call-template name="insert_dd_cell">
4005
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4006
+ </xsl:call-template>
4007
+ </xsl:for-each>
4008
+ </fo:table-row>
4009
+ </xsl:template><xsl:template name="insert_dt_cell">
4010
+ <xsl:param name="key_iso"/>
4011
+ <xsl:param name="split_keep-within-line"/>
4012
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
4013
+
4014
+ <xsl:if test="$isGenerateTableIF = 'true'">
4015
+ <!-- border is mandatory, to calculate real width -->
4016
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4017
+ <xsl:attribute name="text-align">left</xsl:attribute>
4018
+ </xsl:if>
4019
+
4020
+
4021
+ <fo:block xsl:use-attribute-sets="dt-block-style">
4022
+ <xsl:copy-of select="@id"/>
4023
+
4024
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4025
+ <xsl:attribute name="margin-top">0</xsl:attribute>
4026
+ </xsl:if>
4027
+
4028
+
4029
+
4030
+ <xsl:apply-templates>
4031
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4032
+ </xsl:apply-templates>
4033
+
4034
+ <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"/> -->
4035
+
4036
+ </fo:block>
4037
+ </fo:table-cell>
4038
+ </xsl:template><xsl:template name="insert_dd_cell">
4039
+ <xsl:param name="split_keep-within-line"/>
4040
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
4041
+
4042
+ <xsl:if test="$isGenerateTableIF = 'true'">
4043
+ <!-- border is mandatory, to calculate real width -->
4044
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4045
+ </xsl:if>
4046
+
4047
+ <fo:block>
4048
+
4049
+ <xsl:if test="$isGenerateTableIF = 'true'">
4050
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4051
+ </xsl:if>
4052
+
3366
4053
 
3367
- <fo:block xsl:use-attribute-sets="dt-style">
3368
- <xsl:copy-of select="@id"/>
3369
-
3370
- <xsl:if test="normalize-space($key_iso) = 'true'">
3371
- <xsl:attribute name="margin-top">0</xsl:attribute>
3372
- </xsl:if>
3373
-
3374
-
3375
-
3376
- <xsl:apply-templates/>
3377
- </fo:block>
3378
- </fo:table-cell>
3379
- <fo:table-cell>
3380
- <fo:block>
3381
-
3382
4054
 
3383
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3384
- <xsl:with-param name="process">true</xsl:with-param>
3385
- </xsl:apply-templates>
3386
- </fo:block>
3387
- </fo:table-cell>
3388
- </fo:table-row>
4055
+ <xsl:choose>
4056
+ <xsl:when test="$isGenerateTableIF = 'true'">
4057
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
4058
+ <xsl:with-param name="process">true</xsl:with-param>
4059
+ </xsl:apply-templates>
4060
+ </xsl:when>
4061
+ <xsl:otherwise>
4062
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
4063
+ <xsl:with-param name="process">true</xsl:with-param>
4064
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4065
+ </xsl:apply-templates>
4066
+ </xsl:otherwise>
4067
+
4068
+ </xsl:choose>
4069
+
4070
+ <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"/> -->
4071
+
4072
+ </fo:block>
4073
+ </fo:table-cell>
3389
4074
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3390
4075
  <xsl:apply-templates/>
3391
4076
  </xsl:template><xsl:template match="*[local-name()='dd']">
3392
4077
  <xsl:param name="process">false</xsl:param>
4078
+ <xsl:param name="split_keep-within-line"/>
3393
4079
  <xsl:if test="$process = 'true'">
3394
4080
  <xsl:apply-templates select="@language"/>
3395
- <xsl:apply-templates/>
4081
+ <xsl:apply-templates>
4082
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4083
+ </xsl:apply-templates>
3396
4084
  </xsl:if>
3397
4085
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3398
4086
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3399
- </xsl:template><xsl:template match="*[local-name()='em']">
4087
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4088
+ <xsl:param name="id"/>
4089
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4090
+ <tr>
4091
+ <td>
4092
+ <xsl:copy-of select="node()"/>
4093
+ </td>
4094
+ <td>
4095
+
4096
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4097
+
4098
+ <!-- get paragraphs from nested 'dl' -->
4099
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4100
+
4101
+
4102
+ </td>
4103
+ </tr>
4104
+
4105
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4106
+ <xsl:for-each select="*[local-name() = 'dt']">
4107
+ <p>
4108
+ <xsl:copy-of select="node()"/>
4109
+ <xsl:text> </xsl:text>
4110
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4111
+ </p>
4112
+ </xsl:for-each>
4113
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3400
4114
  <fo:inline font-style="italic">
3401
4115
  <xsl:apply-templates/>
3402
4116
  </fo:inline>
3403
4117
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4118
+ <xsl:param name="split_keep-within-line"/>
3404
4119
  <fo:inline font-weight="bold">
3405
4120
 
3406
- <xsl:apply-templates/>
4121
+ <xsl:apply-templates>
4122
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4123
+ </xsl:apply-templates>
3407
4124
  </fo:inline>
3408
4125
  </xsl:template><xsl:template match="*[local-name()='padding']">
3409
4126
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3424,7 +4141,7 @@
3424
4141
 
3425
4142
 
3426
4143
 
3427
-
4144
+ <!-- 10 -->
3428
4145
 
3429
4146
 
3430
4147
 
@@ -3447,13 +4164,15 @@
3447
4164
  <xsl:choose>
3448
4165
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3449
4166
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3450
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4167
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3451
4168
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3452
4169
  </xsl:choose>
3453
4170
  </xsl:attribute>
3454
4171
  </xsl:if>
3455
4172
  <xsl:apply-templates/>
3456
4173
  </fo:inline>
4174
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4175
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3457
4176
  </xsl:template><xsl:template match="*[local-name()='underline']">
3458
4177
  <fo:inline text-decoration="underline">
3459
4178
  <xsl:apply-templates/>
@@ -3601,54 +4320,120 @@
3601
4320
  <fo:block break-after="page"/>
3602
4321
  <fo:block> </fo:block>
3603
4322
  <fo:block break-after="page"/>
4323
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4324
+ <xsl:apply-templates/>
3604
4325
  </xsl:template><xsl:template name="tokenize">
3605
4326
  <xsl:param name="text"/>
3606
4327
  <xsl:param name="separator" select="' '"/>
3607
4328
  <xsl:choose>
4329
+
4330
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4331
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4332
+ </xsl:when>
3608
4333
  <xsl:when test="not(contains($text, $separator))">
3609
4334
  <word>
3610
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3611
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3612
4335
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3613
- <xsl:variable name="len_str">
3614
- <xsl:choose>
3615
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3616
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3617
- </xsl:when>
3618
- <xsl:otherwise>
3619
- <xsl:value-of select="$len_str_tmp"/>
3620
- </xsl:otherwise>
3621
- </xsl:choose>
3622
- </xsl:variable>
3623
-
3624
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3625
- <xsl:message>
3626
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3627
- len_str=<xsl:value-of select="$len_str"/>
3628
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3629
- </xsl:message>
3630
- </xsl:if> -->
3631
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3632
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3633
4336
  <xsl:choose>
3634
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3635
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4337
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4338
+ <xsl:value-of select="$len_str_tmp"/>
3636
4339
  </xsl:when>
3637
4340
  <xsl:otherwise>
3638
- <xsl:value-of select="$len_str"/>
4341
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4342
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4343
+ <xsl:variable name="len_str">
4344
+ <xsl:choose>
4345
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4346
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4347
+ </xsl:when>
4348
+ <xsl:otherwise>
4349
+ <xsl:value-of select="$len_str_tmp"/>
4350
+ </xsl:otherwise>
4351
+ </xsl:choose>
4352
+ </xsl:variable>
4353
+
4354
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4355
+ <xsl:message>
4356
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4357
+ len_str=<xsl:value-of select="$len_str"/>
4358
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4359
+ </xsl:message>
4360
+ </xsl:if> -->
4361
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4362
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4363
+ <xsl:choose>
4364
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4365
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4366
+ </xsl:when>
4367
+ <xsl:otherwise>
4368
+ <xsl:value-of select="$len_str"/>
4369
+ </xsl:otherwise>
4370
+ </xsl:choose>
3639
4371
  </xsl:otherwise>
3640
4372
  </xsl:choose>
3641
4373
  </word>
3642
4374
  </xsl:when>
3643
4375
  <xsl:otherwise>
3644
4376
  <word>
3645
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4377
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4378
+ <xsl:choose>
4379
+ <xsl:when test="$isGenerateTableIF = 'true'">
4380
+ <xsl:value-of select="$word"/>
4381
+ </xsl:when>
4382
+ <xsl:otherwise>
4383
+ <xsl:value-of select="string-length($word)"/>
4384
+ </xsl:otherwise>
4385
+ </xsl:choose>
3646
4386
  </word>
3647
4387
  <xsl:call-template name="tokenize">
3648
4388
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3649
4389
  </xsl:call-template>
3650
4390
  </xsl:otherwise>
3651
4391
  </xsl:choose>
4392
+ </xsl:template><xsl:template name="tokenize_with_tags">
4393
+ <xsl:param name="tags"/>
4394
+ <xsl:param name="text"/>
4395
+ <xsl:param name="separator" select="' '"/>
4396
+ <xsl:choose>
4397
+
4398
+ <xsl:when test="not(contains($text, $separator))">
4399
+ <word>
4400
+ <xsl:call-template name="enclose_text_in_tags">
4401
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4402
+ <xsl:with-param name="tags" select="$tags"/>
4403
+ </xsl:call-template>
4404
+ </word>
4405
+ </xsl:when>
4406
+ <xsl:otherwise>
4407
+ <word>
4408
+ <xsl:call-template name="enclose_text_in_tags">
4409
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4410
+ <xsl:with-param name="tags" select="$tags"/>
4411
+ </xsl:call-template>
4412
+ </word>
4413
+ <xsl:call-template name="tokenize_with_tags">
4414
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4415
+ </xsl:call-template>
4416
+ </xsl:otherwise>
4417
+ </xsl:choose>
4418
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4419
+ <xsl:param name="text"/>
4420
+ <xsl:param name="tags"/>
4421
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4422
+
4423
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4424
+
4425
+ <xsl:choose>
4426
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4427
+ <xsl:otherwise>
4428
+ <xsl:element name="{$tag_name}">
4429
+ <xsl:call-template name="enclose_text_in_tags">
4430
+ <xsl:with-param name="text" select="$text"/>
4431
+ <xsl:with-param name="tags" select="$tags"/>
4432
+ <xsl:with-param name="num" select="$num + 1"/>
4433
+ </xsl:call-template>
4434
+ </xsl:element>
4435
+ </xsl:otherwise>
4436
+ </xsl:choose>
3652
4437
  </xsl:template><xsl:template name="max_length">
3653
4438
  <xsl:param name="words"/>
3654
4439
  <xsl:for-each select="$words//word">
@@ -3749,12 +4534,19 @@
3749
4534
  </xsl:otherwise>
3750
4535
  </xsl:choose>
3751
4536
  </xsl:template><xsl:template name="getSimpleTable">
4537
+ <xsl:param name="id"/>
4538
+
3752
4539
  <xsl:variable name="simple-table">
3753
4540
 
4541
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4542
+ <xsl:variable name="table_without_br">
4543
+ <xsl:apply-templates mode="table-without-br"/>
4544
+ </xsl:variable>
4545
+
3754
4546
  <!-- Step 1. colspan processing -->
3755
4547
  <xsl:variable name="simple-table-colspan">
3756
4548
  <tbody>
3757
- <xsl:apply-templates mode="simple-table-colspan"/>
4549
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3758
4550
  </tbody>
3759
4551
  </xsl:variable>
3760
4552
 
@@ -3763,10 +4555,67 @@
3763
4555
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3764
4556
  </xsl:variable>
3765
4557
 
3766
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3767
-
4558
+ <!-- Step 3: add id to each cell -->
4559
+ <!-- add <word>...</word> for each word, image, math -->
4560
+ <xsl:variable name="simple-table-id">
4561
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4562
+ <xsl:with-param name="id" select="$id"/>
4563
+ </xsl:apply-templates>
4564
+ </xsl:variable>
4565
+
4566
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4567
+
3768
4568
  </xsl:variable>
3769
4569
  <xsl:copy-of select="$simple-table"/>
4570
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4571
+ <xsl:copy>
4572
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4573
+ </xsl:copy>
4574
+ </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">
4575
+ <xsl:copy>
4576
+ <xsl:copy-of select="@*"/>
4577
+ <p>
4578
+ <xsl:copy-of select="node()"/>
4579
+ </p>
4580
+ </xsl:copy>
4581
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4582
+ <xsl:copy>
4583
+ <xsl:copy-of select="@*"/>
4584
+ <xsl:for-each select="*[local-name()='br']">
4585
+ <xsl:variable name="current_id" select="generate-id()"/>
4586
+ <p>
4587
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4588
+ <xsl:copy-of select="."/>
4589
+ </xsl:for-each>
4590
+ </p>
4591
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4592
+ <p>
4593
+ <xsl:for-each select="following-sibling::node()">
4594
+ <xsl:copy-of select="."/>
4595
+ </xsl:for-each>
4596
+ </p>
4597
+ </xsl:if>
4598
+ </xsl:for-each>
4599
+ </xsl:copy>
4600
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4601
+ <xsl:for-each select="*[local-name()='br']">
4602
+ <xsl:variable name="current_id" select="generate-id()"/>
4603
+ <p>
4604
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4605
+ <xsl:copy-of select="."/>
4606
+ </xsl:for-each>
4607
+ </p>
4608
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4609
+ <p>
4610
+ <xsl:for-each select="following-sibling::node()">
4611
+ <xsl:copy-of select="."/>
4612
+ </xsl:for-each>
4613
+ </p>
4614
+ </xsl:if>
4615
+ </xsl:for-each>
4616
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4617
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4618
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3770
4619
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3771
4620
  <xsl:apply-templates mode="simple-table-colspan"/>
3772
4621
  </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">
@@ -3844,18 +4693,138 @@
3844
4693
  </xsl:choose>
3845
4694
  </xsl:for-each>
3846
4695
  </xsl:variable>
3847
-
3848
- <xsl:variable name="newRow">
3849
- <xsl:copy>
3850
- <xsl:copy-of select="$currentRow/@*"/>
3851
- <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
3852
- </xsl:copy>
4696
+
4697
+ <xsl:variable name="newRow">
4698
+ <xsl:copy>
4699
+ <xsl:copy-of select="$currentRow/@*"/>
4700
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
4701
+ </xsl:copy>
4702
+ </xsl:variable>
4703
+ <xsl:copy-of select="$newRow"/>
4704
+
4705
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4706
+ <xsl:with-param name="previousRow" select="$newRow"/>
4707
+ </xsl:apply-templates>
4708
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4709
+ <xsl:param name="id"/>
4710
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4711
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4712
+ <xsl:with-param name="id" select="$id_prefixed"/>
4713
+ </xsl:apply-templates>
4714
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4715
+ <xsl:param name="id"/>
4716
+ <xsl:copy>
4717
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4718
+ <xsl:with-param name="id" select="$id"/>
4719
+ </xsl:apply-templates>
4720
+ </xsl:copy>
4721
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4722
+ <xsl:param name="id"/>
4723
+ <xsl:copy>
4724
+ <xsl:copy-of select="@*"/>
4725
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4726
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4727
+ <xsl:with-param name="id" select="$id"/>
4728
+ </xsl:apply-templates>
4729
+ </xsl:copy>
4730
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4731
+ <xsl:param name="id"/>
4732
+ <xsl:copy>
4733
+ <xsl:copy-of select="@*"/>
4734
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4735
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4736
+ <xsl:attribute name="id">
4737
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4738
+ </xsl:attribute>
4739
+
4740
+ <xsl:for-each select="*[local-name() = 'p']">
4741
+ <xsl:copy>
4742
+ <xsl:copy-of select="@*"/>
4743
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4744
+ <xsl:attribute name="id">
4745
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4746
+ </xsl:attribute>
4747
+
4748
+ <xsl:copy-of select="node()"/>
4749
+ </xsl:copy>
4750
+ </xsl:for-each>
4751
+
4752
+
4753
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4754
+
4755
+ <xsl:variable name="td_text">
4756
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4757
+ </xsl:variable>
4758
+
4759
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4760
+
4761
+ <xsl:variable name="words">
4762
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4763
+ <word>
4764
+ <xsl:copy-of select="."/>
4765
+ </word>
4766
+ </xsl:for-each>
4767
+
4768
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4769
+ <xsl:copy-of select="."/>
4770
+ </xsl:for-each>
4771
+
4772
+ </xsl:variable>
4773
+
4774
+ <xsl:for-each select="xalan:nodeset($words)/word">
4775
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4776
+ <xsl:copy>
4777
+ <xsl:attribute name="id">
4778
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4779
+ </xsl:attribute>
4780
+ <xsl:copy-of select="node()"/>
4781
+ </xsl:copy>
4782
+ </xsl:for-each>
4783
+ </xsl:if>
4784
+ </xsl:copy>
4785
+
4786
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4787
+ <xsl:copy>
4788
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4789
+ </xsl:copy>
4790
+ </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">
4791
+ <xsl:variable name="formatting_tags">
4792
+ <xsl:call-template name="getFormattingTags"/>
4793
+ </xsl:variable>
4794
+ <word>
4795
+ <xsl:call-template name="enclose_text_in_tags">
4796
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4797
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4798
+ </xsl:call-template>
4799
+ </word>
4800
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4801
+
4802
+ <xsl:variable name="td_text" select="."/>
4803
+
4804
+ <xsl:variable name="string_with_added_zerospaces">
4805
+ <xsl:call-template name="add-zero-spaces-java">
4806
+ <xsl:with-param name="text" select="$td_text"/>
4807
+ </xsl:call-template>
3853
4808
  </xsl:variable>
3854
- <xsl:copy-of select="$newRow"/>
3855
-
3856
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3857
- <xsl:with-param name="previousRow" select="$newRow"/>
3858
- </xsl:apply-templates>
4809
+
4810
+ <xsl:variable name="formatting_tags">
4811
+ <xsl:call-template name="getFormattingTags"/>
4812
+ </xsl:variable>
4813
+
4814
+ <!-- <word>text</word> -->
4815
+ <xsl:call-template name="tokenize_with_tags">
4816
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4817
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4818
+ </xsl:call-template>
4819
+ </xsl:template><xsl:template name="getFormattingTags">
4820
+ <tags>
4821
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4822
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4823
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4824
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4825
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4826
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4827
+ </tags>
3859
4828
  </xsl:template><xsl:template name="getLang">
3860
4829
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3861
4830
  <xsl:variable name="language">
@@ -3910,6 +4879,9 @@
3910
4879
  <xsl:variable name="isDeleted" select="@deleted"/>
3911
4880
 
3912
4881
  <fo:inline xsl:use-attribute-sets="mathml-style">
4882
+
4883
+
4884
+
3913
4885
 
3914
4886
 
3915
4887
  <xsl:call-template name="setTrackChangesStyles">
@@ -3917,48 +4889,80 @@
3917
4889
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3918
4890
  </xsl:call-template>
3919
4891
 
4892
+ <xsl:if test="$add_math_as_text = 'true'">
4893
+ <!-- insert helper tag -->
4894
+ <!-- set unique font-size (fiction) -->
4895
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4896
+ <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 -->
4897
+ </xsl:if>
3920
4898
 
3921
-
3922
- <xsl:variable name="mathml">
3923
- <xsl:apply-templates select="." mode="mathml"/>
4899
+ <xsl:variable name="mathml_content">
4900
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3924
4901
  </xsl:variable>
3925
- <fo:instream-foreign-object fox:alt-text="Math">
3926
4902
 
4903
+
4904
+ <xsl:call-template name="mathml_instream_object">
4905
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4906
+ </xsl:call-template>
3927
4907
 
3928
-
3929
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3930
- <xsl:variable name="comment_text_">
3931
- <xsl:choose>
3932
- <xsl:when test="normalize-space($comment_text_following) != ''">
3933
- <xsl:value-of select="$comment_text_following"/>
3934
- </xsl:when>
3935
- <xsl:otherwise>
3936
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3937
- </xsl:otherwise>
3938
- </xsl:choose>
3939
- </xsl:variable>
3940
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3941
-
3942
- <xsl:if test="normalize-space($comment_text) != ''">
3943
- <!-- put Mathin Alternate Text -->
3944
- <xsl:attribute name="fox:alt-text">
3945
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3946
- </xsl:attribute>
3947
- </xsl:if>
3948
-
3949
- <xsl:variable name="mathml_content">
3950
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
3951
- </xsl:variable>
3952
- <!-- put MathML in Actual Text -->
3953
- <xsl:attribute name="fox:actual-text">
3954
- <xsl:value-of select="$mathml_content"/>
3955
- </xsl:attribute>
3956
-
3957
-
3958
-
3959
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
3960
- </fo:instream-foreign-object>
4908
+
3961
4909
  </fo:inline>
4910
+ </xsl:template><xsl:template name="getMathml_comment_text">
4911
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4912
+ <xsl:variable name="comment_text_">
4913
+ <xsl:choose>
4914
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4915
+ <xsl:value-of select="$comment_text_following"/>
4916
+ </xsl:when>
4917
+ <xsl:otherwise>
4918
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4919
+ </xsl:otherwise>
4920
+ </xsl:choose>
4921
+ </xsl:variable>
4922
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4923
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4924
+ <xsl:value-of select="$comment_text"/>
4925
+ </xsl:template><xsl:template name="mathml_instream_object">
4926
+ <xsl:param name="comment_text"/>
4927
+ <xsl:param name="mathml_content"/>
4928
+
4929
+ <xsl:variable name="comment_text_">
4930
+ <xsl:choose>
4931
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4932
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4933
+ </xsl:choose>
4934
+ </xsl:variable>
4935
+
4936
+ <xsl:variable name="mathml">
4937
+ <xsl:apply-templates select="." mode="mathml"/>
4938
+ </xsl:variable>
4939
+
4940
+ <fo:instream-foreign-object fox:alt-text="Math">
4941
+
4942
+
4943
+
4944
+
4945
+
4946
+
4947
+
4948
+ <!-- put MathML in Actual Text -->
4949
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4950
+ <xsl:attribute name="fox:actual-text">
4951
+ <xsl:value-of select="$mathml_content"/>
4952
+ </xsl:attribute>
4953
+
4954
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4955
+ <xsl:if test="normalize-space($comment_text_) != ''">
4956
+ <!-- put Mathin Alternate Text -->
4957
+ <xsl:attribute name="fox:alt-text">
4958
+ <xsl:value-of select="$comment_text_"/>
4959
+ </xsl:attribute>
4960
+ </xsl:if>
4961
+ <!-- </xsl:if> -->
4962
+
4963
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4964
+
4965
+ </fo:instream-foreign-object>
3962
4966
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3963
4967
  <!-- <xsl:text>a+b</xsl:text> -->
3964
4968
  <xsl:text>&lt;</xsl:text>
@@ -3989,7 +4993,9 @@
3989
4993
  <!-- replace start and end spaces to non-break space -->
3990
4994
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3991
4995
  </xsl:copy>
3992
- </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">
4996
+ </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">
4997
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
4998
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3993
4999
  <xsl:variable name="target">
3994
5000
  <xsl:choose>
3995
5001
  <xsl:when test="@updatetype = 'true'">
@@ -4586,18 +5592,33 @@
4586
5592
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4587
5593
  <xsl:copy>
4588
5594
  <xsl:apply-templates select="@*" mode="svg_update"/>
4589
- <xsl:variable name="viewbox">
5595
+ <xsl:variable name="viewbox_">
4590
5596
  <xsl:call-template name="split">
4591
5597
  <xsl:with-param name="pText" select="@viewBox"/>
4592
5598
  <xsl:with-param name="sep" select="' '"/>
4593
5599
  </xsl:call-template>
4594
5600
  </xsl:variable>
5601
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5602
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5603
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5604
+
4595
5605
  <xsl:attribute name="width">
4596
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5606
+ <xsl:choose>
5607
+ <xsl:when test="$width != ''">
5608
+ <xsl:value-of select="round($width)"/>
5609
+ </xsl:when>
5610
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5611
+ </xsl:choose>
4597
5612
  </xsl:attribute>
4598
5613
  <xsl:attribute name="height">
4599
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5614
+ <xsl:choose>
5615
+ <xsl:when test="$height != ''">
5616
+ <xsl:value-of select="round($height)"/>
5617
+ </xsl:when>
5618
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5619
+ </xsl:choose>
4600
5620
  </xsl:attribute>
5621
+
4601
5622
  <xsl:apply-templates mode="svg_update"/>
4602
5623
  </xsl:copy>
4603
5624
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4792,7 +5813,11 @@
4792
5813
  <xsl:apply-templates mode="bookmarks"/>
4793
5814
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4794
5815
  <xsl:apply-templates select="."/>
4795
- </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">
5816
+ </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">
5817
+ <xsl:apply-templates mode="contents"/>
5818
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5819
+ <xsl:apply-templates mode="bookmarks"/>
5820
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4796
5821
  <xsl:apply-templates mode="bookmarks"/>
4797
5822
  </xsl:template><xsl:template name="addBookmarks">
4798
5823
  <xsl:param name="contents"/>
@@ -5074,7 +6099,9 @@
5074
6099
  <xsl:apply-templates/>
5075
6100
  </xsl:otherwise>
5076
6101
  </xsl:choose>
5077
- </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">
6102
+ </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">
6103
+ <xsl:value-of select="."/>
6104
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5078
6105
  <xsl:text> </xsl:text>
5079
6106
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5080
6107
  <xsl:copy>
@@ -5105,9 +6132,22 @@
5105
6132
  </xsl:when>
5106
6133
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5107
6134
  </xsl:choose>
6135
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6136
+ <xsl:call-template name="keep_together_standard_number"/>
6137
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6138
+ <xsl:apply-templates mode="contents_item"/>
5108
6139
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5109
6140
 
5110
6141
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6142
+
6143
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6144
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6145
+ </xsl:if>
6146
+
6147
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6148
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6149
+ </xsl:if>
6150
+
5111
6151
  <xsl:copy-of select="@id"/>
5112
6152
 
5113
6153
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5132,7 +6172,7 @@
5132
6172
 
5133
6173
 
5134
6174
 
5135
-
6175
+ <!-- 9 -->
5136
6176
 
5137
6177
 
5138
6178
 
@@ -5216,7 +6256,7 @@
5216
6256
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5217
6257
  <xsl:choose>
5218
6258
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5219
- <xsl:call-template name="interspers">
6259
+ <xsl:call-template name="interspers-java">
5220
6260
  <xsl:with-param name="str" select="."/>
5221
6261
  </xsl:call-template>
5222
6262
  </xsl:when>
@@ -5266,6 +6306,10 @@
5266
6306
  <xsl:with-param name="char" select="$char"/>
5267
6307
  </xsl:call-template>
5268
6308
  </xsl:if>
6309
+ </xsl:template><xsl:template name="interspers-java">
6310
+ <xsl:param name="str"/>
6311
+ <xsl:param name="char" select="$zero_width_space"/>
6312
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5269
6313
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5270
6314
  <xsl:apply-templates mode="syntax_highlight"/>
5271
6315
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5478,7 +6522,9 @@
5478
6522
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5479
6523
  </xsl:if>
5480
6524
  <xsl:variable name="simple-table">
5481
- <xsl:call-template name="getSimpleTable"/>
6525
+ <xsl:call-template name="getSimpleTable">
6526
+ <xsl:with-param name="id" select="@id"/>
6527
+ </xsl:call-template>
5482
6528
  </xsl:variable>
5483
6529
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5484
6530
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5585,39 +6631,67 @@
5585
6631
  </xsl:otherwise>
5586
6632
  </xsl:choose>
5587
6633
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5588
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5589
-
6634
+
6635
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6636
+
5590
6637
 
6638
+
5591
6639
  <xsl:variable name="fo_element">
5592
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6640
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5593
6641
  inline
5594
6642
  </xsl:variable>
5595
6643
 
5596
- <!-- display 'EXAMPLE' -->
5597
- <xsl:apply-templates select="*[local-name()='name']">
5598
- <xsl:with-param name="fo_element" select="$fo_element"/>
5599
- </xsl:apply-templates>
6644
+ <fo:block-container margin-left="0mm">
5600
6645
 
5601
- <xsl:choose>
5602
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5603
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5604
- <fo:block-container margin-left="0mm" margin-right="0mm">
5605
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6646
+ <xsl:choose>
6647
+
6648
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6649
+
6650
+ <!-- display name 'EXAMPLE' in a separate block -->
6651
+ <fo:block>
6652
+ <xsl:apply-templates select="*[local-name()='name']">
5606
6653
  <xsl:with-param name="fo_element" select="$fo_element"/>
5607
6654
  </xsl:apply-templates>
6655
+ </fo:block>
6656
+
6657
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6658
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6659
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6660
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6661
+ </xsl:apply-templates>
6662
+ </fo:block-container>
5608
6663
  </fo:block-container>
5609
- </fo:block-container>
5610
- </xsl:when>
5611
- <xsl:otherwise>
5612
- <fo:inline>
5613
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5614
- <xsl:with-param name="fo_element" select="$fo_element"/>
5615
- </xsl:apply-templates>
5616
- </fo:inline>
5617
- </xsl:otherwise>
5618
- </xsl:choose>
5619
-
5620
- </fo:block>
6664
+ </xsl:when> <!-- end block -->
6665
+
6666
+ <xsl:otherwise> <!-- inline -->
6667
+
6668
+ <!-- display 'EXAMPLE' and first element in the same line -->
6669
+ <fo:block>
6670
+ <xsl:apply-templates select="*[local-name()='name']">
6671
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6672
+ </xsl:apply-templates>
6673
+ <fo:inline>
6674
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6675
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6676
+ </xsl:apply-templates>
6677
+ </fo:inline>
6678
+ </fo:block>
6679
+
6680
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6681
+ <!-- display further elements in blocks -->
6682
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6683
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6684
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6685
+ <xsl:with-param name="fo_element" select="'block'"/>
6686
+ </xsl:apply-templates>
6687
+ </fo:block-container>
6688
+ </fo:block-container>
6689
+ </xsl:if>
6690
+ </xsl:otherwise> <!-- end inline -->
6691
+
6692
+ </xsl:choose>
6693
+ </fo:block-container>
6694
+ </fo:block-container>
5621
6695
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5622
6696
  <xsl:param name="fo_element">block</xsl:param>
5623
6697
 
@@ -5649,10 +6723,16 @@
5649
6723
  </xsl:variable>
5650
6724
  <xsl:choose>
5651
6725
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5652
- <fo:block xsl:use-attribute-sets="example-p-style">
5653
-
5654
- <xsl:apply-templates/>
5655
- </fo:block>
6726
+ <fo:block-container>
6727
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6728
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6729
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6730
+ </xsl:if>
6731
+ <fo:block xsl:use-attribute-sets="example-p-style">
6732
+
6733
+ <xsl:apply-templates/>
6734
+ </fo:block>
6735
+ </fo:block-container>
5656
6736
  </xsl:when>
5657
6737
  <xsl:otherwise>
5658
6738
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5833,7 +6913,16 @@
5833
6913
  </fo:inline>
5834
6914
  </xsl:when>
5835
6915
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5836
- <fo:inline><xsl:apply-templates/></fo:inline>
6916
+
6917
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6918
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6919
+ <xsl:choose>
6920
+ <xsl:when test="$uri_src != ''">
6921
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6922
+ </xsl:when>
6923
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6924
+ </xsl:choose>
6925
+
5837
6926
  </xsl:otherwise>
5838
6927
  </xsl:choose>
5839
6928
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6014,10 +7103,24 @@
6014
7103
 
6015
7104
  </fo:block>
6016
7105
  <xsl:apply-templates/>
6017
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7106
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
6018
7107
  <!-- comment 2019-11-29 -->
6019
7108
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6020
7109
  <xsl:apply-templates /> -->
7110
+
7111
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7112
+
7113
+ <xsl:choose>
7114
+ <!-- if there isn't the attribute '@from', then -->
7115
+ <xsl:when test="$id_from = ''">
7116
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7117
+ </xsl:when>
7118
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7119
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7120
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7121
+ </xsl:when>
7122
+ </xsl:choose>
7123
+
6021
7124
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6022
7125
  <!-- 0xA0 to space replacement -->
6023
7126
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6162,6 +7265,11 @@
6162
7265
  </xsl:otherwise>
6163
7266
  </xsl:choose>
6164
7267
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7268
+
7269
+ <xsl:apply-templates select="*[local-name() = 'name']">
7270
+ <xsl:with-param name="process">true</xsl:with-param>
7271
+ </xsl:apply-templates>
7272
+
6165
7273
  <fo:list-block xsl:use-attribute-sets="list-style">
6166
7274
 
6167
7275
 
@@ -6176,12 +7284,23 @@
6176
7284
 
6177
7285
 
6178
7286
 
7287
+ <xsl:if test="*[local-name() = 'name']">
7288
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7289
+ </xsl:if>
7290
+
6179
7291
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6180
7292
  </fo:list-block>
6181
7293
  <!-- <xsl:for-each select="./iho:note">
6182
7294
  <xsl:call-template name="note"/>
6183
7295
  </xsl:for-each> -->
6184
7296
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7297
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7298
+ <xsl:param name="process">false</xsl:param>
7299
+ <xsl:if test="$process = 'true'">
7300
+ <fo:block xsl:use-attribute-sets="list-name-style">
7301
+ <xsl:apply-templates/>
7302
+ </fo:block>
7303
+ </xsl:if>
6185
7304
  </xsl:template><xsl:template match="*[local-name()='li']">
6186
7305
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6187
7306
  <xsl:copy-of select="@id"/>
@@ -6378,7 +7497,10 @@
6378
7497
  <!-- to split by '_' and other chars -->
6379
7498
  <xsl:call-template name="add-zero-spaces-java"/>
6380
7499
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6381
- <fo:inline id="{@id}" font-size="1pt"/>
7500
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7501
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7502
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7503
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6382
7504
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6383
7505
  <!-- <row>
6384
7506
  <date>05-07-2013</date>
@@ -6489,26 +7611,23 @@
6489
7611
  <xsl:if test=".//*[local-name() = 'fn']">
6490
7612
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
6491
7613
  </xsl:if>
7614
+
7615
+ <!-- display document identifier, not number [1] -->
6492
7616
  <xsl:variable name="docidentifier">
6493
7617
  <xsl:choose>
6494
7618
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6495
7619
  <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
6496
7620
  </xsl:choose>
6497
7621
  </xsl:variable>
6498
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
7622
+ <xsl:value-of select="$docidentifier"/>
7623
+
6499
7624
  <xsl:apply-templates select="*[local-name() = 'note']"/>
6500
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6501
- <xsl:choose>
6502
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6503
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6504
- </xsl:when>
6505
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6506
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6507
- </xsl:when>
6508
- <xsl:otherwise>
6509
- <xsl:apply-templates select="*[local-name() = 'title']"/>
6510
- </xsl:otherwise>
6511
- </xsl:choose>
7625
+
7626
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
7627
+ <xsl:text>,</xsl:text>
7628
+ <xsl:text> </xsl:text>
7629
+ </xsl:if>
7630
+
6512
7631
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6513
7632
  <!-- end bibitem processing -->
6514
7633
 
@@ -6830,25 +7949,32 @@
6830
7949
  </fo:block-container>
6831
7950
 
6832
7951
  </xsl:template><xsl:template name="displayAdmonitionName">
6833
-
7952
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
7953
+ <!-- <xsl:choose>
7954
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
7955
+ <xsl:choose>
7956
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
7957
+ <xsl:otherwise>
7958
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7959
+ </xsl:otherwise>
7960
+ </xsl:choose>
7961
+ </xsl:when>
7962
+ <xsl:otherwise>
6834
7963
  <xsl:apply-templates select="*[local-name() = 'name']"/>
6835
7964
  <xsl:if test="not(*[local-name() = 'name'])">
6836
7965
  <xsl:apply-templates select="@type"/>
6837
7966
  </xsl:if>
6838
-
6839
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
6840
- <xsl:apply-templates/>
6841
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
6842
- <xsl:variable name="admonition_type_">
6843
- <xsl:call-template name="getLocalizedString">
6844
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
6845
- </xsl:call-template>
7967
+ </xsl:otherwise>
7968
+ </xsl:choose> -->
7969
+ <xsl:variable name="name">
7970
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6846
7971
  </xsl:variable>
6847
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
6848
- <xsl:value-of select="$admonition_type"/>
6849
- <xsl:if test="$admonition_type = ''">
6850
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
7972
+ <xsl:copy-of select="$name"/>
7973
+ <xsl:if test="normalize-space($name) != ''">
7974
+ <xsl:value-of select="$sep"/>
6851
7975
  </xsl:if>
7976
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7977
+ <xsl:apply-templates/>
6852
7978
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
6853
7979
  <!-- processing for admonition/p found in the template for 'p' -->
6854
7980
  <xsl:call-template name="paragraph"/>
@@ -6925,6 +8051,120 @@
6925
8051
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6926
8052
  </xsl:for-each>
6927
8053
  </xsl:copy>
8054
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8055
+ <xsl:apply-templates mode="update_xml_step1"/>
8056
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
8057
+ <xsl:copy>
8058
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
8059
+ </xsl:copy>
8060
+ </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">
8061
+
8062
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
8063
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
8064
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8065
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8066
+ <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))"/>
8067
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
8068
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8069
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8070
+ <xsl:with-param name="text" select="$text_"/>
8071
+ </xsl:call-template></text></xsl:variable>
8072
+
8073
+ <xsl:variable name="parent" select="local-name(..)"/>
8074
+
8075
+ <xsl:variable name="text2">
8076
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
8077
+ <xsl:copy-of select="."/>
8078
+ </xsl:for-each></text>
8079
+ </xsl:variable>
8080
+
8081
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
8082
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
8083
+ <xsl:variable name="text3">
8084
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
8085
+ <xsl:choose>
8086
+ <xsl:when test="self::text()">
8087
+ <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))"/>
8088
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8089
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8090
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8091
+ <xsl:with-param name="text" select="$text_units_"/>
8092
+ </xsl:call-template></text></xsl:variable>
8093
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8094
+ </xsl:when>
8095
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8096
+ </xsl:choose>
8097
+ </xsl:for-each></text>
8098
+ </xsl:variable>
8099
+
8100
+ <xsl:choose>
8101
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8102
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8103
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8104
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8105
+ <xsl:choose>
8106
+ <xsl:when test="self::text()">
8107
+ <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))"/>
8108
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8109
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8110
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8111
+ <xsl:with-param name="text" select="$text_dots_"/>
8112
+ </xsl:call-template></text></xsl:variable>
8113
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8114
+ </xsl:when>
8115
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8116
+ </xsl:choose>
8117
+ </xsl:for-each>
8118
+ </xsl:when>
8119
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8120
+ </xsl:choose>
8121
+
8122
+ </xsl:template><xsl:template name="replace_text_tags">
8123
+ <xsl:param name="tag_open"/>
8124
+ <xsl:param name="tag_close"/>
8125
+ <xsl:param name="text"/>
8126
+ <xsl:choose>
8127
+ <xsl:when test="contains($text, $tag_open)">
8128
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8129
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8130
+
8131
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8132
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8133
+ </xsl:element>
8134
+
8135
+ <xsl:call-template name="replace_text_tags">
8136
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8137
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8138
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8139
+ </xsl:call-template>
8140
+ </xsl:when>
8141
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8142
+ </xsl:choose>
8143
+ </xsl:template><xsl:template name="printEdition">
8144
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8145
+ <xsl:text> </xsl:text>
8146
+ <xsl:choose>
8147
+ <xsl:when test="$edition_i18n != ''">
8148
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8149
+ <xsl:call-template name="capitalize">
8150
+ <xsl:with-param name="str" select="$edition_i18n"/>
8151
+ </xsl:call-template>
8152
+ </xsl:when>
8153
+ <xsl:otherwise>
8154
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8155
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8156
+ <xsl:call-template name="capitalize">
8157
+ <xsl:with-param name="str">
8158
+ <xsl:call-template name="getLocalizedString">
8159
+ <xsl:with-param name="key">edition</xsl:with-param>
8160
+ </xsl:call-template>
8161
+ </xsl:with-param>
8162
+ </xsl:call-template>
8163
+ <xsl:text> </xsl:text>
8164
+ <xsl:value-of select="$edition"/>
8165
+ </xsl:if>
8166
+ </xsl:otherwise>
8167
+ </xsl:choose>
6928
8168
  </xsl:template><xsl:template name="convertDate">
6929
8169
  <xsl:param name="date"/>
6930
8170
  <xsl:param name="format" select="'short'"/>
@@ -7612,4 +8852,40 @@
7612
8852
  <xsl:value-of select="$value"/>
7613
8853
  </xsl:otherwise>
7614
8854
  </xsl:choose>
8855
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8856
+ <xsl:param name="level">0</xsl:param>
8857
+
8858
+ <fo:block margin-left="{2*$level}mm">
8859
+ <xsl:text>
8860
+ &lt;</xsl:text>
8861
+ <xsl:value-of select="local-name()"/>
8862
+ <xsl:for-each select="@*">
8863
+ <xsl:text> </xsl:text>
8864
+ <xsl:value-of select="local-name()"/>
8865
+ <xsl:text>="</xsl:text>
8866
+ <xsl:value-of select="."/>
8867
+ <xsl:text>"</xsl:text>
8868
+ </xsl:for-each>
8869
+ <xsl:text>&gt;</xsl:text>
8870
+
8871
+ <xsl:if test="not(*)">
8872
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8873
+ <xsl:text>&lt;/</xsl:text>
8874
+ <xsl:value-of select="local-name()"/>
8875
+ <xsl:text>&gt;</xsl:text>
8876
+ </xsl:if>
8877
+ </fo:block>
8878
+
8879
+ <xsl:if test="*">
8880
+ <fo:block>
8881
+ <xsl:apply-templates mode="print_as_xml">
8882
+ <xsl:with-param name="level" select="$level + 1"/>
8883
+ </xsl:apply-templates>
8884
+ </fo:block>
8885
+ <fo:block margin-left="{2*$level}mm">
8886
+ <xsl:text>&lt;/</xsl:text>
8887
+ <xsl:value-of select="local-name()"/>
8888
+ <xsl:text>&gt;</xsl:text>
8889
+ </fo:block>
8890
+ </xsl:if>
7615
8891
  </xsl:template></xsl:stylesheet>