metanorma-csa 2.0.8 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -454,6 +454,7 @@
454
454
 
455
455
  <xsl:template match="csa:p" name="paragraph">
456
456
  <xsl:param name="inline" select="'false'"/>
457
+ <xsl:param name="split_keep-within-line"/>
457
458
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
458
459
  <xsl:variable name="element-name">
459
460
  <xsl:choose>
@@ -481,7 +482,9 @@
481
482
  </xsl:choose>
482
483
  </xsl:attribute>
483
484
  <xsl:attribute name="line-height">155%</xsl:attribute>
484
- <xsl:apply-templates/>
485
+ <xsl:apply-templates>
486
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
487
+ </xsl:apply-templates>
485
488
  </xsl:element>
486
489
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
487
490
  <fo:block margin-bottom="12pt">
@@ -571,12 +574,41 @@
571
574
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAASEAAAEhCAYAAAAwHRYbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3BpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5z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kSuQmCC</xsl:text>
572
575
  </xsl:variable>
573
576
 
574
- <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">
577
+ <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_">
578
+ <xsl:for-each select="$table_widths_from_if//table">
579
+ <xsl:copy>
580
+ <xsl:copy-of select="@*"/>
581
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
582
+ </xsl:copy>
583
+ </xsl:for-each>
584
+ </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_">
585
+ false
586
+ </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
575
587
  <xsl:call-template name="getLang"/>
576
- </xsl:variable><xsl:variable name="pageWidth_">
577
- 215.9
588
+ </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_">
589
+ <xsl:choose>
590
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
591
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
592
+ </xsl:choose>
593
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
594
+ <xsl:choose>
595
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
596
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
597
+ </xsl:choose>
598
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
599
+ <xsl:choose>
600
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
601
+ <xsl:otherwise>
602
+ 215.9
603
+ </xsl:otherwise>
604
+ </xsl:choose>
578
605
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
579
- 279.4
606
+ <xsl:choose>
607
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
608
+ <xsl:otherwise>
609
+ 279.4
610
+ </xsl:otherwise>
611
+ </xsl:choose>
580
612
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
581
613
  25
582
614
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -586,20 +618,7 @@
586
618
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
587
619
  21
588
620
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
589
-
590
- <title-edition lang="en">
591
-
592
- <xsl:text>Version</xsl:text>
593
-
594
- </title-edition>
595
-
596
- <title-edition lang="fr">
597
- <xsl:text>Édition </xsl:text>
598
- </title-edition>
599
621
 
600
- <title-edition lang="ru">
601
- <xsl:text>Издание </xsl:text>
602
- </title-edition>
603
622
 
604
623
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
605
624
  <title-toc lang="en">
@@ -680,7 +699,7 @@
680
699
  </xsl:variable><xsl:variable name="bibdata">
681
700
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
682
701
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
683
- </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">
702
+ </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">
684
703
  <xsl:param name="name"/>
685
704
  <xsl:param name="lang"/>
686
705
  <xsl:variable name="lang_">
@@ -728,7 +747,7 @@
728
747
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
729
748
 
730
749
  <xsl:variable name="additional_fonts_">
731
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
750
+ <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']">
732
751
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
733
752
  </xsl:for-each>
734
753
  </xsl:variable>
@@ -803,7 +822,6 @@
803
822
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
804
823
 
805
824
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
806
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
807
825
 
808
826
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
809
827
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -892,6 +910,7 @@
892
910
 
893
911
 
894
912
 
913
+
895
914
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
896
915
 
897
916
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -1040,6 +1059,7 @@
1040
1059
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1041
1060
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1042
1061
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1062
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1043
1063
  <xsl:attribute name="display-align">center</xsl:attribute>
1044
1064
 
1045
1065
 
@@ -1058,6 +1078,7 @@
1058
1078
  <xsl:attribute name="display-align">center</xsl:attribute>
1059
1079
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1060
1080
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
1081
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1061
1082
 
1062
1083
 
1063
1084
 
@@ -1140,7 +1161,8 @@
1140
1161
  </xsl:attribute-set><xsl:attribute-set name="dt-row-style">
1141
1162
 
1142
1163
 
1143
- </xsl:attribute-set><xsl:attribute-set name="dt-style">
1164
+ </xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
1165
+ </xsl:attribute-set><xsl:attribute-set name="dt-block-style">
1144
1166
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1145
1167
 
1146
1168
 
@@ -1152,6 +1174,25 @@
1152
1174
 
1153
1175
 
1154
1176
 
1177
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1178
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1179
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+ </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1195
+ <xsl:attribute name="padding-left">2mm</xsl:attribute>
1155
1196
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1156
1197
 
1157
1198
 
@@ -1471,6 +1512,22 @@
1471
1512
 
1472
1513
 
1473
1514
 
1515
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1516
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1517
+
1518
+
1519
+
1520
+
1521
+
1522
+
1523
+
1524
+
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1474
1531
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1475
1532
 
1476
1533
 
@@ -1883,13 +1940,13 @@
1883
1940
 
1884
1941
  </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">
1885
1942
  <xsl:variable name="nodes_preface_">
1886
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1943
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1887
1944
  <node id="{@id}"/>
1888
1945
  </xsl:for-each>
1889
1946
  </xsl:variable>
1890
1947
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
1891
1948
 
1892
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1949
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1893
1950
  <xsl:sort select="@displayorder" data-type="number"/>
1894
1951
 
1895
1952
  <!-- process Section's title -->
@@ -1955,7 +2012,7 @@
1955
2012
  </xsl:for-each>
1956
2013
  </figures>
1957
2014
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1958
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2015
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1959
2016
  <xsl:sort select="@displayorder" data-type="number"/>
1960
2017
  <xsl:apply-templates select="."/>
1961
2018
  </xsl:for-each>
@@ -1975,22 +2032,32 @@
1975
2032
  <xsl:sort select="@displayorder" data-type="number"/>
1976
2033
  <xsl:apply-templates select="."/>
1977
2034
  </xsl:for-each>
1978
- </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">
1979
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
1980
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
1981
- <xsl:call-template name="replace_fo_inline">
1982
- <xsl:with-param name="text" select="$text"/>
1983
- </xsl:call-template>
1984
- </xsl:template><xsl:template name="replace_fo_inline">
2035
+ </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">
2036
+
2037
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2038
+ <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))"/>
2039
+ <xsl:call-template name="replace_fo_inline_tags">
2040
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2041
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2042
+ <xsl:with-param name="text" select="$text"/>
2043
+ </xsl:call-template>
2044
+
2045
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2046
+ <xsl:param name="tag_open"/>
2047
+ <xsl:param name="tag_close"/>
1985
2048
  <xsl:param name="text"/>
1986
2049
  <xsl:choose>
1987
2050
  <xsl:when test="contains($text, $tag_open)">
1988
2051
  <xsl:value-of select="substring-before($text, $tag_open)"/>
1989
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2052
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
1990
2053
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
1991
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
1992
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
1993
- <xsl:call-template name="replace_fo_inline">
2054
+ <fo:inline keep-together.within-line="always">
2055
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2056
+ </fo:inline>
2057
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2058
+ <xsl:call-template name="replace_fo_inline_tags">
2059
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2060
+ <xsl:with-param name="tag_close" select="$tag_close"/>
1994
2061
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
1995
2062
  </xsl:call-template>
1996
2063
  </xsl:when>
@@ -1998,6 +2065,39 @@
1998
2065
  </xsl:choose>
1999
2066
  </xsl:template><xsl:template match="*[local-name()='br']">
2000
2067
  <xsl:value-of select="$linebreak"/>
2068
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2069
+ <xsl:param name="split_keep-within-line"/>
2070
+
2071
+ <!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
2072
+ <xsl:choose>
2073
+
2074
+ <xsl:when test="normalize-space($split_keep-within-line) = 'true'">
2075
+ <xsl:variable name="sep">_</xsl:variable>
2076
+ <xsl:variable name="items">
2077
+ <xsl:call-template name="split">
2078
+ <xsl:with-param name="pText" select="."/>
2079
+ <xsl:with-param name="sep" select="$sep"/>
2080
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
2081
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
2082
+ </xsl:call-template>
2083
+ </xsl:variable>
2084
+ <xsl:for-each select="xalan:nodeset($items)/item">
2085
+ <xsl:choose>
2086
+ <xsl:when test=". = $sep">
2087
+ <xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
2088
+ </xsl:when>
2089
+ <xsl:otherwise>
2090
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2091
+ </xsl:otherwise>
2092
+ </xsl:choose>
2093
+ </xsl:for-each>
2094
+ </xsl:when>
2095
+
2096
+ <xsl:otherwise>
2097
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2098
+ </xsl:otherwise>
2099
+
2100
+ </xsl:choose>
2001
2101
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2002
2102
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2003
2103
  <xsl:apply-templates/>
@@ -2063,8 +2163,23 @@
2063
2163
  </xsl:call-template>
2064
2164
 
2065
2165
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2066
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2067
- <xsl:call-template name="add-zero-spaces-java"/>
2166
+ <xsl:choose>
2167
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2168
+ <xsl:value-of select="."/>
2169
+ </xsl:when>
2170
+ <xsl:otherwise>
2171
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2172
+ </xsl:otherwise>
2173
+ </xsl:choose>
2174
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2175
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2176
+ <!-- <xsl:copy-of select="$text"/> -->
2177
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2178
+ <xsl:choose>
2179
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2180
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2181
+ </xsl:choose>
2182
+ </xsl:for-each>
2068
2183
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2069
2184
 
2070
2185
  <xsl:variable name="table-preamble">
@@ -2074,9 +2189,14 @@
2074
2189
 
2075
2190
  <xsl:variable name="table">
2076
2191
 
2077
- <xsl:variable name="simple-table">
2078
- <xsl:call-template name="getSimpleTable"/>
2192
+ <xsl:variable name="simple-table">
2193
+ <xsl:call-template name="getSimpleTable">
2194
+ <xsl:with-param name="id" select="@id"/>
2195
+ </xsl:call-template>
2079
2196
  </xsl:variable>
2197
+ <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2198
+
2199
+ <!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
2080
2200
 
2081
2201
 
2082
2202
  <!-- Display table's name before table as standalone block -->
@@ -2097,7 +2217,23 @@
2097
2217
  </xsl:call-template>
2098
2218
  </xsl:if>
2099
2219
  </xsl:variable>
2100
- <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2220
+ <!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
2221
+
2222
+ <!-- DEBUG -->
2223
+ <xsl:if test="$table_if_debug = 'true'">
2224
+ <fo:block font-size="60%">
2225
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
2226
+ </fo:block>
2227
+ </xsl:if>
2228
+
2229
+
2230
+ <!-- <xsl:copy-of select="$colwidths"/> -->
2231
+
2232
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
2233
+ DEBUG
2234
+ colwidths=<xsl:copy-of select="$colwidths"/>
2235
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
2236
+
2101
2237
 
2102
2238
 
2103
2239
  <xsl:variable name="margin-side">
@@ -2164,9 +2300,17 @@
2164
2300
  </xsl:element>
2165
2301
  </xsl:variable>
2166
2302
 
2303
+ <xsl:if test="$isGenerateTableIF = 'true'">
2304
+ <!-- to determine start of table -->
2305
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
2306
+ </xsl:if>
2167
2307
 
2168
2308
  <fo:table id="{@id}">
2169
2309
 
2310
+ <xsl:if test="$isGenerateTableIF = 'true'">
2311
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
2312
+ </xsl:if>
2313
+
2170
2314
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
2171
2315
  <xsl:attribute name="{local-name()}">
2172
2316
  <xsl:value-of select="."/>
@@ -2180,31 +2324,47 @@
2180
2324
 
2181
2325
 
2182
2326
  <xsl:choose>
2183
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2184
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2185
- <fo:table-column column-width="{@width}"/>
2186
- </xsl:for-each>
2327
+ <xsl:when test="$isGenerateTableIF = 'true'">
2328
+ <!-- generate IF for table widths -->
2329
+ <!-- example:
2330
+ <tr>
2331
+ <td valign="top" align="left" id="tab-symdu_1_1">
2332
+ <p>Symbol</p>
2333
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
2334
+ </td>
2335
+ <td valign="top" align="left" id="tab-symdu_1_2">
2336
+ <p>Description</p>
2337
+ <word id="tab-symdu_1_2_word_1">Description</word>
2338
+ </td>
2339
+ </tr>
2340
+ -->
2341
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2342
+
2187
2343
  </xsl:when>
2188
2344
  <xsl:otherwise>
2189
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2190
- <xsl:choose>
2191
- <xsl:when test=". = 1 or . = 0">
2192
- <fo:table-column column-width="proportional-column-width(2)"/>
2193
- </xsl:when>
2194
- <xsl:otherwise>
2195
- <fo:table-column column-width="proportional-column-width({.})"/>
2196
- </xsl:otherwise>
2197
- </xsl:choose>
2198
- </xsl:for-each>
2199
- </xsl:otherwise>
2200
- </xsl:choose>
2201
2345
 
2202
- <xsl:choose>
2203
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2204
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2205
- </xsl:when>
2206
- <xsl:otherwise>
2207
- <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 -->
2346
+ <xsl:choose>
2347
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2348
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2349
+ <fo:table-column column-width="{@width}"/>
2350
+ </xsl:for-each>
2351
+ </xsl:when>
2352
+ <xsl:otherwise>
2353
+ <xsl:call-template name="insertTableColumnWidth">
2354
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2355
+ </xsl:call-template>
2356
+ </xsl:otherwise>
2357
+ </xsl:choose>
2358
+
2359
+ <xsl:choose>
2360
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2361
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2362
+ </xsl:when>
2363
+ <xsl:otherwise>
2364
+ <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 -->
2365
+ </xsl:otherwise>
2366
+ </xsl:choose>
2367
+
2208
2368
  </xsl:otherwise>
2209
2369
  </xsl:choose>
2210
2370
 
@@ -2307,11 +2467,22 @@
2307
2467
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2308
2468
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2309
2469
  </xsl:template><xsl:template name="calculate-column-widths">
2470
+ <xsl:param name="table"/>
2471
+ <xsl:param name="cols-count"/>
2472
+
2473
+ <xsl:call-template name="calculate-column-widths-proportional">
2474
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2475
+ <xsl:with-param name="table" select="$table"/>
2476
+ </xsl:call-template>
2477
+
2478
+ </xsl:template><xsl:template name="calculate-column-widths-proportional">
2310
2479
  <xsl:param name="table"/>
2311
2480
  <xsl:param name="cols-count"/>
2312
2481
  <xsl:param name="curr-col" select="1"/>
2313
2482
  <xsl:param name="width" select="0"/>
2314
2483
 
2484
+ <!-- table=<xsl:copy-of select="$table"/> -->
2485
+
2315
2486
  <xsl:if test="$curr-col &lt;= $cols-count">
2316
2487
  <xsl:variable name="widths">
2317
2488
  <xsl:choose>
@@ -2349,16 +2520,22 @@
2349
2520
  </xsl:for-each>
2350
2521
  </xsl:when>
2351
2522
  <xsl:otherwise>
2352
- <xsl:for-each select="xalan:nodeset($table)/*/tr">
2523
+ <!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
2524
+
2525
+ <!-- <table><xsl:copy-of select="$table"/></table>
2526
+ -->
2527
+ <xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
2353
2528
  <xsl:variable name="td_text">
2354
2529
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2355
2530
  </xsl:variable>
2531
+ <!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
2356
2532
  <xsl:variable name="words">
2357
2533
  <xsl:variable name="string_with_added_zerospaces">
2358
2534
  <xsl:call-template name="add-zero-spaces-java">
2359
2535
  <xsl:with-param name="text" select="$td_text"/>
2360
2536
  </xsl:call-template>
2361
2537
  </xsl:variable>
2538
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2362
2539
  <xsl:call-template name="tokenize">
2363
2540
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2364
2541
  <!-- 2009 thinspace -->
@@ -2366,11 +2543,13 @@
2366
2543
  <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2367
2544
  </xsl:call-template>
2368
2545
  </xsl:variable>
2546
+ <!-- words=<xsl:copy-of select="$words"/> -->
2369
2547
  <xsl:variable name="max_length">
2370
2548
  <xsl:call-template name="max_length">
2371
2549
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2372
2550
  </xsl:call-template>
2373
2551
  </xsl:variable>
2552
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2374
2553
  <width>
2375
2554
  <xsl:variable name="divider">
2376
2555
  <xsl:choose>
@@ -2389,6 +2568,8 @@
2389
2568
  </xsl:choose>
2390
2569
  </xsl:variable>
2391
2570
 
2571
+ <!-- widths=<xsl:copy-of select="$widths"/> -->
2572
+
2392
2573
  <column>
2393
2574
  <xsl:for-each select="xalan:nodeset($widths)//width">
2394
2575
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2397,29 +2578,271 @@
2397
2578
  </xsl:if>
2398
2579
  </xsl:for-each>
2399
2580
  </column>
2400
- <xsl:call-template name="calculate-column-widths">
2581
+ <xsl:call-template name="calculate-column-widths-proportional">
2401
2582
  <xsl:with-param name="cols-count" select="$cols-count"/>
2402
2583
  <xsl:with-param name="curr-col" select="$curr-col +1"/>
2403
2584
  <xsl:with-param name="table" select="$table"/>
2404
2585
  </xsl:call-template>
2405
2586
  </xsl:if>
2587
+ </xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
2588
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2589
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2590
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2591
+
2592
+ <!-- if all capitals english letters or digits -->
2593
+ <xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
2594
+ <xsl:call-template name="repeat">
2595
+ <xsl:with-param name="char" select="'X'"/>
2596
+ <xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
2597
+ </xsl:call-template>
2598
+ </xsl:if>
2406
2599
  </xsl:template><xsl:template match="text()" mode="td_text">
2407
2600
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2408
2601
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2409
2602
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2410
2603
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2411
2604
  <xsl:value-of select="@target"/>
2412
- </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2413
- <xsl:variable name="mathml">
2414
- <xsl:for-each select="*">
2415
- <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2416
- <xsl:copy-of select="."/>
2417
- </xsl:if>
2605
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
2606
+ <xsl:if test="$isGenerateTableIF = 'false'">
2607
+ <xsl:variable name="mathml_">
2608
+ <xsl:for-each select="*">
2609
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2610
+ <xsl:copy-of select="."/>
2611
+ </xsl:if>
2612
+ </xsl:for-each>
2613
+ </xsl:variable>
2614
+ <xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
2615
+
2616
+ <xsl:variable name="math_text">
2617
+ <xsl:value-of select="normalize-space($mathml)"/>
2618
+ <xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
2619
+ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
2620
+ </xsl:variable>
2621
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2622
+ </xsl:if>
2623
+ </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2624
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2625
+
2626
+ <!-- via intermediate format -->
2627
+
2628
+ <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2629
+
2630
+ <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
2631
+
2632
+ <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2633
+
2634
+ <!-- get current table id -->
2635
+ <xsl:variable name="table_id" select="@id"/>
2636
+ <!-- find table by id in the file 'table_widths' -->
2637
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2638
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2639
+
2640
+ <!-- table='<xsl:copy-of select="$table"/>' -->
2641
+ <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2642
+ <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2643
+ <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2644
+
2645
+ <xsl:variable name="table_with_cell_widths_">
2646
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2647
+ </xsl:variable>
2648
+ <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2649
+
2650
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2651
+ <xsl:copy-of select="$table_with_cell_widths"/>
2652
+ </xsl:if> -->
2653
+
2654
+
2655
+ <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2656
+
2657
+ <xsl:variable name="column_widths_">
2658
+ <!-- iteration of columns -->
2659
+ <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2660
+ <xsl:variable name="pos" select="position()"/>
2661
+ <column>
2662
+ <xsl:attribute name="width_max">
2663
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2664
+ <xsl:sort select="." data-type="number" order="descending"/>
2665
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2666
+ </xsl:for-each>
2667
+ </xsl:attribute>
2668
+ <xsl:attribute name="width_min">
2669
+ <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2670
+ <xsl:sort select="." data-type="number" order="descending"/>
2671
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2672
+ </xsl:for-each>
2673
+ </xsl:attribute>
2674
+ </column>
2418
2675
  </xsl:for-each>
2419
2676
  </xsl:variable>
2677
+ <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2678
+
2679
+ <!-- <column_widths>
2680
+ <xsl:copy-of select="$column_widths"/>
2681
+ </column_widths> -->
2682
+
2683
+ <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2684
+ <xsl:variable name="table_widths_">
2685
+ <table>
2686
+ <xsl:attribute name="width_max">
2687
+ <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2688
+ </xsl:attribute>
2689
+ <xsl:attribute name="width_min">
2690
+ <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2691
+ </xsl:attribute>
2692
+ </table>
2693
+ </xsl:variable>
2694
+ <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2695
+
2696
+ <xsl:variable name="page_width">
2697
+ <xsl:choose>
2698
+ <xsl:when test="$parent_table_page-width != ''">
2699
+ <xsl:value-of select="$parent_table_page-width"/>
2700
+ </xsl:when>
2701
+ <xsl:otherwise>
2702
+ <xsl:value-of select="@page-width"/>
2703
+ </xsl:otherwise>
2704
+ </xsl:choose>
2705
+ </xsl:variable>
2706
+
2707
+ <xsl:if test="$table_if_debug = 'true'">
2708
+ <table_width>
2709
+ <xsl:copy-of select="$table_widths"/>
2710
+ </table_width>
2711
+ <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2712
+ </xsl:if>
2713
+
2714
+
2715
+ <!-- There are three cases: -->
2716
+ <xsl:choose>
2717
+ <!-- 1. The minimum table width is equal to or wider than the available space -->
2718
+ <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2719
+ <!-- call old algorithm -->
2720
+ <case1/>
2721
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2722
+ <xsl:call-template name="calculate-column-widths-proportional">
2723
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2724
+ <xsl:with-param name="table" select="$table"/>
2725
+ </xsl:call-template> -->
2726
+ </xsl:when>
2727
+ <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2728
+ <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2729
+ <case2/>
2730
+ <autolayout/>
2731
+ <xsl:for-each select="$column_widths/column/@width_max">
2732
+ <column divider="100"><xsl:value-of select="."/></column>
2733
+ </xsl:for-each>
2734
+ </xsl:when>
2735
+ <!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
2736
+ In this case, find the difference between the available space and the minimum table width, lets call it W.
2737
+ Lets also call D the difference between maximum and minimum width of the table.
2738
+ For each column, let d be the difference between maximum and minimum width of that column.
2739
+ Now set the column's width to the minimum width plus d times W over D.
2740
+ This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2741
+ <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)">
2742
+ <!-- difference between the available space and the minimum table width -->
2743
+ <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2744
+ <W><xsl:value-of select="$W"/></W>
2745
+ <!-- difference between maximum and minimum width of the table -->
2746
+ <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2747
+ <D><xsl:value-of select="$D"/></D>
2748
+ <case3/>
2749
+ <autolayout/>
2750
+ <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2751
+ <split_keep-within-line>true</split_keep-within-line>
2752
+ </xsl:if>
2753
+ <xsl:for-each select="$column_widths/column">
2754
+ <!-- difference between maximum and minimum width of that column. -->
2755
+ <xsl:variable name="d" select="@width_max - @width_min"/>
2756
+ <d><xsl:value-of select="$d"/></d>
2757
+ <width_min><xsl:value-of select="@width_min"/></width_min>
2758
+ <e><xsl:value-of select="$d * $W div $D"/></e>
2759
+ <!-- set the column's width to the minimum width plus d times W over D. -->
2760
+ <column divider="100">
2761
+ <xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
2762
+ </column>
2763
+ </xsl:for-each>
2764
+
2765
+ </xsl:when>
2766
+ <xsl:otherwise><unknown_case/></xsl:otherwise>
2767
+ </xsl:choose>
2768
+
2769
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
2770
+
2771
+ <!-- if nested 'dl' or 'table' -->
2772
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
2773
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
2774
+
2775
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2776
+
2777
+ <xsl:variable name="parent_table_page-width_">
2778
+ <xsl:if test="$parent_table_id != ''">
2779
+ <!-- determine column number in the parent table -->
2780
+ <xsl:variable name="parent_table_column_number">
2781
+ <xsl:choose>
2782
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2783
+ <xsl:otherwise> <!-- parent is table -->
2784
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2785
+ </xsl:otherwise>
2786
+ </xsl:choose>
2787
+ </xsl:variable>
2788
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2789
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2790
+ </xsl:if>
2791
+ </xsl:variable>
2792
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2793
+
2794
+ <!-- get current table id -->
2795
+ <xsl:variable name="table_id" select="@id"/>
2796
+
2797
+ <xsl:choose>
2798
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
2799
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
2800
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
2801
+ </xsl:when>
2802
+ <xsl:otherwise>
2803
+ <!-- recalculate columns width based on parent table width -->
2804
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
2805
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
2806
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
2807
+ </xsl:call-template>
2808
+ </xsl:for-each>
2809
+ </xsl:otherwise>
2810
+ </xsl:choose>
2420
2811
 
2421
- <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2422
- <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2812
+ </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
2813
+ <xsl:copy>
2814
+ <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2815
+ </xsl:copy>
2816
+ </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
2817
+ <xsl:copy>
2818
+ <xsl:copy-of select="@*"/>
2819
+
2820
+ <!-- The maximum width is given by the widest line. -->
2821
+ <xsl:attribute name="width_max">
2822
+ <xsl:for-each select="p_len">
2823
+ <xsl:sort select="." data-type="number" order="descending"/>
2824
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2825
+ </xsl:for-each>
2826
+ </xsl:attribute>
2827
+
2828
+ <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2829
+ <xsl:variable name="width_min">
2830
+ <xsl:for-each select="word_len">
2831
+ <xsl:sort select="." data-type="number" order="descending"/>
2832
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2833
+ </xsl:for-each>
2834
+ </xsl:variable>
2835
+ <xsl:attribute name="width_min">
2836
+ <xsl:value-of select="$width_min"/>
2837
+ </xsl:attribute>
2838
+
2839
+ <xsl:if test="$width_min = 0">
2840
+ <xsl:attribute name="width_min">1</xsl:attribute>
2841
+ </xsl:if>
2842
+
2843
+ <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
2844
+
2845
+ </xsl:copy>
2423
2846
  </xsl:template><xsl:template match="*[local-name()='thead']">
2424
2847
  <xsl:param name="cols-count"/>
2425
2848
  <fo:table-header>
@@ -2504,16 +2927,10 @@
2504
2927
  </xsl:for-each>
2505
2928
  </xsl:when>
2506
2929
  <xsl:otherwise>
2507
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2508
- <xsl:choose>
2509
- <xsl:when test=". = 1 or . = 0">
2510
- <fo:table-column column-width="proportional-column-width(2)"/>
2511
- </xsl:when>
2512
- <xsl:otherwise>
2513
- <fo:table-column column-width="proportional-column-width({.})"/>
2514
- </xsl:otherwise>
2515
- </xsl:choose>
2516
- </xsl:for-each>
2930
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
2931
+ <xsl:call-template name="insertTableColumnWidth">
2932
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2933
+ </xsl:call-template>
2517
2934
  </xsl:otherwise>
2518
2935
  </xsl:choose>
2519
2936
 
@@ -2590,6 +3007,52 @@
2590
3007
 
2591
3008
  </fo:table-body>
2592
3009
 
3010
+ </xsl:template><xsl:template match="/" mode="process_table-if">
3011
+ <xsl:param name="table_or_dl">table</xsl:param>
3012
+ <xsl:apply-templates mode="process_table-if">
3013
+ <xsl:with-param name="table_or_dl" select="$table_or_dl"/>
3014
+ </xsl:apply-templates>
3015
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
3016
+ <xsl:param name="table_or_dl">table</xsl:param>
3017
+
3018
+ <fo:table-body>
3019
+ <xsl:for-each select="*[local-name() = 'tr']">
3020
+ <xsl:variable name="col_count" select="count(*)"/>
3021
+
3022
+ <!-- iteration for each tr/td -->
3023
+
3024
+ <xsl:choose>
3025
+ <xsl:when test="$table_or_dl = 'table'">
3026
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3027
+ <fo:table-row number-columns-spanned="{$col_count}">
3028
+ <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3029
+ <xsl:call-template name="td"/>
3030
+ </fo:table-row>
3031
+ </xsl:for-each>
3032
+ </xsl:when>
3033
+ <xsl:otherwise> <!-- $table_or_dl = 'dl' -->
3034
+ <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
3035
+ <xsl:variable name="is_dt" select="position() = 1"/>
3036
+
3037
+ <xsl:for-each select="*">
3038
+ <!-- <test><xsl:copy-of select="."/></test> -->
3039
+ <fo:table-row number-columns-spanned="{$col_count}">
3040
+ <xsl:choose>
3041
+ <xsl:when test="$is_dt">
3042
+ <xsl:call-template name="insert_dt_cell"/>
3043
+ </xsl:when>
3044
+ <xsl:otherwise>
3045
+ <xsl:call-template name="insert_dd_cell"/>
3046
+ </xsl:otherwise>
3047
+ </xsl:choose>
3048
+ </fo:table-row>
3049
+ </xsl:for-each>
3050
+ </xsl:for-each>
3051
+ </xsl:otherwise>
3052
+ </xsl:choose>
3053
+
3054
+ </xsl:for-each>
3055
+ </fo:table-body>
2593
3056
  </xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2594
3057
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2595
3058
 
@@ -2676,7 +3139,7 @@
2676
3139
  </xsl:choose>
2677
3140
  </xsl:attribute>
2678
3141
  </xsl:if>
2679
- </xsl:template><xsl:template match="*[local-name()='td']">
3142
+ </xsl:template><xsl:template match="*[local-name()='td']" name="td">
2680
3143
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
2681
3144
  <xsl:call-template name="setTextAlignment">
2682
3145
  <xsl:with-param name="default">left</xsl:with-param>
@@ -2710,11 +3173,24 @@
2710
3173
 
2711
3174
  <xsl:call-template name="setTableCellAttributes"/>
2712
3175
 
3176
+ <xsl:if test="$isGenerateTableIF = 'true'">
3177
+ <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3178
+ <xsl:attribute name="text-align">left</xsl:attribute>
3179
+ </xsl:if>
3180
+
2713
3181
  <fo:block>
2714
3182
 
3183
+ <xsl:if test="$isGenerateTableIF = 'true'">
3184
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3185
+ </xsl:if>
3186
+
3187
+
2715
3188
 
2716
3189
 
2717
3190
  <xsl:apply-templates/>
3191
+
3192
+ <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"/> -->
3193
+
2718
3194
  </fo:block>
2719
3195
  </fo:table-cell>
2720
3196
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
@@ -2911,9 +3387,9 @@
2911
3387
  <!-- current hierarchy is 'figure' element -->
2912
3388
  <xsl:variable name="following_dl_colwidths">
2913
3389
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2914
- <xsl:variable name="html-table">
2915
- <xsl:variable name="doc_ns">
2916
-
3390
+ <xsl:variable name="simple-table">
3391
+ <!-- <xsl:variable name="doc_ns">
3392
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
2917
3393
  </xsl:variable>
2918
3394
  <xsl:variable name="ns">
2919
3395
  <xsl:choose>
@@ -2924,7 +3400,7 @@
2924
3400
  <xsl:value-of select="substring-before(name(/*), '-')"/>
2925
3401
  </xsl:otherwise>
2926
3402
  </xsl:choose>
2927
- </xsl:variable>
3403
+ </xsl:variable> -->
2928
3404
 
2929
3405
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2930
3406
  <tbody>
@@ -2935,7 +3411,7 @@
2935
3411
 
2936
3412
  <xsl:call-template name="calculate-column-widths">
2937
3413
  <xsl:with-param name="cols-count" select="2"/>
2938
- <xsl:with-param name="table" select="$html-table"/>
3414
+ <xsl:with-param name="table" select="$simple-table"/>
2939
3415
  </xsl:call-template>
2940
3416
 
2941
3417
  </xsl:if>
@@ -3054,8 +3530,10 @@
3054
3530
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3055
3531
  </xsl:variable>
3056
3532
 
3533
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3534
+
3057
3535
  <xsl:choose>
3058
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3536
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3059
3537
 
3060
3538
  <fo:block margin-bottom="12pt" text-align="left">
3061
3539
 
@@ -3070,7 +3548,7 @@
3070
3548
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3071
3549
  </fo:block>
3072
3550
 
3073
- </xsl:when>
3551
+ </xsl:when> <!-- END: only one component -->
3074
3552
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3075
3553
  <fo:block margin-bottom="12pt" text-align="left">
3076
3554
 
@@ -3084,8 +3562,8 @@
3084
3562
  </xsl:variable>
3085
3563
  <xsl:value-of select="$title-where"/>
3086
3564
  </fo:block>
3087
- </xsl:when>
3088
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3565
+ </xsl:when> <!-- END: a few components -->
3566
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3089
3567
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3090
3568
 
3091
3569
 
@@ -3098,22 +3576,41 @@
3098
3576
  </xsl:variable>
3099
3577
  <xsl:value-of select="$title-key"/>
3100
3578
  </fo:block>
3101
- </xsl:when>
3579
+ </xsl:when> <!-- END: definition list in a figure -->
3102
3580
  </xsl:choose>
3103
3581
 
3104
3582
  <!-- a few components -->
3105
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3583
+ <xsl:if test="$onlyOneComponent = 'false'">
3106
3584
  <fo:block>
3107
3585
 
3108
3586
 
3109
3587
 
3110
3588
 
3589
+
3590
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3591
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3592
+ </xsl:if>
3593
+
3111
3594
  <fo:block>
3112
3595
 
3113
3596
 
3114
3597
 
3115
3598
 
3599
+ <xsl:apply-templates select="*[local-name() = 'name']">
3600
+ <xsl:with-param name="process">true</xsl:with-param>
3601
+ </xsl:apply-templates>
3602
+
3603
+ <xsl:if test="$isGenerateTableIF = 'true'">
3604
+ <!-- to determine start of table -->
3605
+ <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
3606
+ </xsl:if>
3607
+
3116
3608
  <fo:table width="95%" table-layout="fixed">
3609
+
3610
+ <xsl:if test="$isGenerateTableIF = 'true'">
3611
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
3612
+ </xsl:if>
3613
+
3117
3614
 
3118
3615
  <xsl:choose>
3119
3616
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
@@ -3122,61 +3619,178 @@
3122
3619
 
3123
3620
  </xsl:when>
3124
3621
  </xsl:choose>
3125
- <!-- create virtual html table for dl/[dt and dd] -->
3126
- <xsl:variable name="html-table">
3127
- <xsl:variable name="doc_ns">
3622
+
3623
+
3624
+
3625
+ <xsl:choose>
3626
+ <xsl:when test="$isGenerateTableIF = 'true'">
3627
+ <!-- generate IF for table widths -->
3628
+ <!-- example:
3629
+ <tr>
3630
+ <td valign="top" align="left" id="tab-symdu_1_1">
3631
+ <p>Symbol</p>
3632
+ <word id="tab-symdu_1_1_word_1">Symbol</word>
3633
+ </td>
3634
+ <td valign="top" align="left" id="tab-symdu_1_2">
3635
+ <p>Description</p>
3636
+ <word id="tab-symdu_1_2_word_1">Description</word>
3637
+ </td>
3638
+ </tr>
3639
+ -->
3128
3640
 
3129
- </xsl:variable>
3130
- <xsl:variable name="ns">
3131
- <xsl:choose>
3132
- <xsl:when test="normalize-space($doc_ns) != ''">
3133
- <xsl:value-of select="normalize-space($doc_ns)"/>
3134
- </xsl:when>
3135
- <xsl:otherwise>
3136
- <xsl:value-of select="substring-before(name(/*), '-')"/>
3137
- </xsl:otherwise>
3138
- </xsl:choose>
3139
- </xsl:variable>
3140
- <tbody>
3141
- <xsl:apply-templates mode="dl"/>
3142
- </tbody>
3143
- </xsl:variable>
3144
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3145
- <xsl:variable name="colwidths">
3146
- <xsl:call-template name="calculate-column-widths">
3147
- <xsl:with-param name="cols-count" select="2"/>
3148
- <xsl:with-param name="table" select="$html-table"/>
3149
- </xsl:call-template>
3150
- </xsl:variable>
3151
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3152
- <xsl:variable name="maxlength_dt">
3153
- <xsl:call-template name="getMaxLength_dt"/>
3154
- </xsl:variable>
3155
- <xsl:call-template name="setColumnWidth_dl">
3156
- <xsl:with-param name="colwidths" select="$colwidths"/>
3157
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3158
- </xsl:call-template>
3159
- <fo:table-body>
3160
- <xsl:apply-templates>
3161
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3162
- </xsl:apply-templates>
3163
- </fo:table-body>
3641
+ <!-- create virtual html table for dl/[dt and dd] -->
3642
+ <xsl:variable name="simple-table">
3643
+
3644
+ <xsl:variable name="dl_table">
3645
+ <tbody>
3646
+ <xsl:apply-templates mode="dl_if">
3647
+ <xsl:with-param name="id" select="@id"/>
3648
+ </xsl:apply-templates>
3649
+ </tbody>
3650
+ </xsl:variable>
3651
+
3652
+ <!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
3653
+
3654
+ <!-- Step: replace <br/> to <p>...</p> -->
3655
+ <xsl:variable name="table_without_br">
3656
+ <xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
3657
+ </xsl:variable>
3658
+
3659
+ <!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
3660
+
3661
+ <!-- Step: add id to each cell -->
3662
+ <!-- add <word>...</word> for each word, image, math -->
3663
+ <xsl:variable name="simple-table-id">
3664
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
3665
+ <xsl:with-param name="id" select="@id"/>
3666
+ </xsl:apply-templates>
3667
+ </xsl:variable>
3668
+
3669
+ <!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
3670
+
3671
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
3672
+
3673
+ </xsl:variable>
3674
+
3675
+ <!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
3676
+
3677
+ <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
3678
+ <xsl:with-param name="table_or_dl">dl</xsl:with-param>
3679
+ </xsl:apply-templates>
3680
+
3681
+ </xsl:when>
3682
+ <xsl:otherwise>
3683
+
3684
+ <xsl:variable name="simple-table">
3685
+
3686
+ <xsl:variable name="dl_table">
3687
+ <tbody>
3688
+ <xsl:apply-templates mode="dl">
3689
+ <xsl:with-param name="id" select="@id"/>
3690
+ </xsl:apply-templates>
3691
+ </tbody>
3692
+ </xsl:variable>
3693
+
3694
+ <xsl:copy-of select="$dl_table"/>
3695
+ </xsl:variable>
3696
+
3697
+ <xsl:variable name="colwidths">
3698
+ <xsl:call-template name="calculate-column-widths">
3699
+ <xsl:with-param name="cols-count" select="2"/>
3700
+ <xsl:with-param name="table" select="$simple-table"/>
3701
+ </xsl:call-template>
3702
+ </xsl:variable>
3703
+
3704
+ <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
3705
+ DEBUG
3706
+ colwidths=<xsl:copy-of select="$colwidths"/>
3707
+ <xsl:text disable-output-escaping="yes">- -&gt;</xsl:text> -->
3708
+
3709
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3710
+
3711
+ <xsl:variable name="maxlength_dt">
3712
+ <xsl:call-template name="getMaxLength_dt"/>
3713
+ </xsl:variable>
3714
+
3715
+ <xsl:variable name="isContainsKeepTogetherTag_">
3716
+ false
3717
+ </xsl:variable>
3718
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3719
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3720
+
3721
+
3722
+ <xsl:call-template name="setColumnWidth_dl">
3723
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3724
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3725
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3726
+ </xsl:call-template>
3727
+
3728
+ <fo:table-body>
3729
+
3730
+ <!-- DEBUG -->
3731
+ <xsl:if test="$table_if_debug = 'true'">
3732
+ <fo:table-row>
3733
+ <fo:table-cell number-columns-spanned="2" font-size="60%">
3734
+ <xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
3735
+ </fo:table-cell>
3736
+ </fo:table-row>
3737
+ </xsl:if>
3738
+
3739
+ <xsl:apply-templates>
3740
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3741
+ <xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
3742
+ </xsl:apply-templates>
3743
+
3744
+ </fo:table-body>
3745
+ </xsl:otherwise>
3746
+ </xsl:choose>
3164
3747
  </fo:table>
3165
3748
  </fo:block>
3166
3749
  </fo:block>
3167
- </xsl:if>
3750
+ </xsl:if> <!-- END: a few components -->
3168
3751
  </fo:block-container>
3169
3752
  </fo:block-container>
3753
+
3754
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
3755
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
3756
+ </xsl:if>
3757
+
3758
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3759
+ <xsl:param name="process">false</xsl:param>
3760
+ <xsl:if test="$process = 'true'">
3761
+ <fo:block xsl:use-attribute-sets="dl-name-style">
3762
+ <xsl:apply-templates/>
3763
+ </fo:block>
3764
+ </xsl:if>
3170
3765
  </xsl:template><xsl:template name="setColumnWidth_dl">
3171
3766
  <xsl:param name="colwidths"/>
3172
3767
  <xsl:param name="maxlength_dt"/>
3768
+ <xsl:param name="isContainsKeepTogetherTag"/>
3769
+
3770
+ <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3771
+
3173
3772
  <xsl:choose>
3773
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3774
+ <xsl:call-template name="insertTableColumnWidth">
3775
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3776
+ </xsl:call-template>
3777
+ </xsl:when>
3174
3778
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3175
3779
  <fo:table-column column-width="50%"/>
3176
3780
  <fo:table-column column-width="50%"/>
3177
3781
  </xsl:when>
3178
3782
  <xsl:otherwise>
3179
3783
  <xsl:choose>
3784
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3785
+ <xsl:call-template name="insertTableColumnWidth">
3786
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3787
+ </xsl:call-template>
3788
+ </xsl:when>
3789
+ <xsl:when test="$isContainsKeepTogetherTag">
3790
+ <xsl:call-template name="insertTableColumnWidth">
3791
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3792
+ </xsl:call-template>
3793
+ </xsl:when>
3180
3794
  <!-- to set width check most wide chars like `W` -->
3181
3795
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3182
3796
  <fo:table-column column-width="7%"/>
@@ -3207,20 +3821,31 @@
3207
3821
  <fo:table-column column-width="60%"/>
3208
3822
  </xsl:when>
3209
3823
  <xsl:otherwise>
3210
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3211
- <xsl:choose>
3212
- <xsl:when test=". = 1 or . = 0">
3213
- <fo:table-column column-width="proportional-column-width(2)"/>
3214
- </xsl:when>
3215
- <xsl:otherwise>
3216
- <fo:table-column column-width="proportional-column-width({.})"/>
3217
- </xsl:otherwise>
3218
- </xsl:choose>
3219
- </xsl:for-each>
3824
+ <xsl:call-template name="insertTableColumnWidth">
3825
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3826
+ </xsl:call-template>
3220
3827
  </xsl:otherwise>
3221
3828
  </xsl:choose>
3222
3829
  </xsl:otherwise>
3223
3830
  </xsl:choose>
3831
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3832
+ <xsl:param name="colwidths"/>
3833
+
3834
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3835
+ <xsl:choose>
3836
+ <xsl:when test=". = 1 or . = 0">
3837
+ <fo:table-column column-width="proportional-column-width(2)"/>
3838
+ </xsl:when>
3839
+ <xsl:otherwise>
3840
+ <!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
3841
+ <xsl:variable name="divider">
3842
+ <xsl:value-of select="@divider"/>
3843
+ <xsl:if test="not(@divider)">1</xsl:if>
3844
+ </xsl:variable>
3845
+ <fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
3846
+ </xsl:otherwise>
3847
+ </xsl:choose>
3848
+ </xsl:for-each>
3224
3849
  </xsl:template><xsl:template name="getMaxLength_dt">
3225
3850
  <xsl:variable name="lengths">
3226
3851
  <xsl:for-each select="*[local-name()='dt']">
@@ -3244,7 +3869,6 @@
3244
3869
  <xsl:value-of select="$maxLength"/>
3245
3870
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3246
3871
  <xsl:param name="key_iso"/>
3247
-
3248
3872
  <!-- <tr>
3249
3873
  <td>NOTE</td>
3250
3874
  <td>
@@ -3252,27 +3876,47 @@
3252
3876
  </td>
3253
3877
  </tr>
3254
3878
  -->
3255
- <fo:table-row>
3879
+ <!-- OLD Variant -->
3880
+ <!-- <fo:table-row>
3256
3881
  <fo:table-cell>
3257
3882
  <fo:block margin-top="6pt">
3258
3883
  <xsl:if test="normalize-space($key_iso) = 'true'">
3259
3884
  <xsl:attribute name="margin-top">0</xsl:attribute>
3260
3885
  </xsl:if>
3261
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3886
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3262
3887
  </fo:block>
3263
3888
  </fo:table-cell>
3264
3889
  <fo:table-cell>
3265
3890
  <fo:block>
3266
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3891
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3892
+ </fo:block>
3893
+ </fo:table-cell>
3894
+ </fo:table-row> -->
3895
+ <!-- <tr>
3896
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3897
+ </tr>
3898
+ -->
3899
+ <fo:table-row>
3900
+ <fo:table-cell number-columns-spanned="2">
3901
+ <fo:block>
3902
+ <xsl:call-template name="note"/>
3267
3903
  </fo:block>
3268
3904
  </fo:table-cell>
3269
3905
  </fo:table-row>
3270
3906
  </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3907
+ <xsl:param name="id"/>
3908
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
3271
3909
  <tr>
3272
3910
  <td>
3911
+ <xsl:attribute name="id">
3912
+ <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
3913
+ </xsl:attribute>
3273
3914
  <xsl:apply-templates/>
3274
3915
  </td>
3275
3916
  <td>
3917
+ <xsl:attribute name="id">
3918
+ <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
3919
+ </xsl:attribute>
3276
3920
 
3277
3921
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3278
3922
  <xsl:with-param name="process">true</xsl:with-param>
@@ -3283,50 +3927,134 @@
3283
3927
 
3284
3928
  </xsl:template><xsl:template match="*[local-name()='dt']">
3285
3929
  <xsl:param name="key_iso"/>
3930
+ <xsl:param name="split_keep-within-line"/>
3286
3931
 
3287
3932
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3288
- <fo:table-cell>
3933
+ <xsl:call-template name="insert_dt_cell">
3934
+ <xsl:with-param name="key_iso" select="$key_iso"/>
3935
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3936
+ </xsl:call-template>
3937
+ <xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
3938
+ <xsl:call-template name="insert_dd_cell">
3939
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3940
+ </xsl:call-template>
3941
+ </xsl:for-each>
3942
+ </fo:table-row>
3943
+ </xsl:template><xsl:template name="insert_dt_cell">
3944
+ <xsl:param name="key_iso"/>
3945
+ <xsl:param name="split_keep-within-line"/>
3946
+ <fo:table-cell xsl:use-attribute-sets="dt-cell-style">
3947
+
3948
+ <xsl:if test="$isGenerateTableIF = 'true'">
3949
+ <!-- border is mandatory, to calculate real width -->
3950
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3951
+ <xsl:attribute name="text-align">left</xsl:attribute>
3952
+ </xsl:if>
3953
+
3954
+
3955
+ <fo:block xsl:use-attribute-sets="dt-block-style">
3956
+ <xsl:copy-of select="@id"/>
3957
+
3958
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3959
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3960
+ </xsl:if>
3961
+
3962
+
3963
+
3964
+ <xsl:apply-templates>
3965
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3966
+ </xsl:apply-templates>
3967
+
3968
+ <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"/> -->
3969
+
3970
+ </fo:block>
3971
+ </fo:table-cell>
3972
+ </xsl:template><xsl:template name="insert_dd_cell">
3973
+ <xsl:param name="split_keep-within-line"/>
3974
+ <fo:table-cell xsl:use-attribute-sets="dd-cell-style">
3975
+
3976
+ <xsl:if test="$isGenerateTableIF = 'true'">
3977
+ <!-- border is mandatory, to calculate real width -->
3978
+ <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3979
+ </xsl:if>
3980
+
3981
+ <fo:block>
3982
+
3983
+ <xsl:if test="$isGenerateTableIF = 'true'">
3984
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
3985
+ </xsl:if>
3986
+
3289
3987
 
3290
- <fo:block xsl:use-attribute-sets="dt-style">
3291
- <xsl:copy-of select="@id"/>
3292
-
3293
- <xsl:if test="normalize-space($key_iso) = 'true'">
3294
- <xsl:attribute name="margin-top">0</xsl:attribute>
3295
- </xsl:if>
3296
-
3297
-
3298
-
3299
- <xsl:apply-templates/>
3300
- </fo:block>
3301
- </fo:table-cell>
3302
- <fo:table-cell>
3303
- <fo:block>
3304
-
3305
3988
 
3306
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
3307
- <xsl:with-param name="process">true</xsl:with-param>
3308
- </xsl:apply-templates>
3309
- </fo:block>
3310
- </fo:table-cell>
3311
- </fo:table-row>
3989
+ <xsl:choose>
3990
+ <xsl:when test="$isGenerateTableIF = 'true'">
3991
+ <xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
3992
+ <xsl:with-param name="process">true</xsl:with-param>
3993
+ </xsl:apply-templates>
3994
+ </xsl:when>
3995
+ <xsl:otherwise>
3996
+ <xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
3997
+ <xsl:with-param name="process">true</xsl:with-param>
3998
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
3999
+ </xsl:apply-templates>
4000
+ </xsl:otherwise>
4001
+
4002
+ </xsl:choose>
4003
+
4004
+ <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"/> -->
4005
+
4006
+ </fo:block>
4007
+ </fo:table-cell>
3312
4008
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3313
4009
  <xsl:apply-templates/>
3314
4010
  </xsl:template><xsl:template match="*[local-name()='dd']">
3315
4011
  <xsl:param name="process">false</xsl:param>
4012
+ <xsl:param name="split_keep-within-line"/>
3316
4013
  <xsl:if test="$process = 'true'">
3317
4014
  <xsl:apply-templates select="@language"/>
3318
- <xsl:apply-templates/>
4015
+ <xsl:apply-templates>
4016
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4017
+ </xsl:apply-templates>
3319
4018
  </xsl:if>
3320
4019
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3321
4020
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3322
- </xsl:template><xsl:template match="*[local-name()='em']">
4021
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
4022
+ <xsl:param name="id"/>
4023
+ <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4024
+ <tr>
4025
+ <td>
4026
+ <xsl:copy-of select="node()"/>
4027
+ </td>
4028
+ <td>
4029
+
4030
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4031
+
4032
+ <!-- get paragraphs from nested 'dl' -->
4033
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4034
+
4035
+
4036
+ </td>
4037
+ </tr>
4038
+
4039
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4040
+ <xsl:for-each select="*[local-name() = 'dt']">
4041
+ <p>
4042
+ <xsl:copy-of select="node()"/>
4043
+ <xsl:text> </xsl:text>
4044
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4045
+ </p>
4046
+ </xsl:for-each>
4047
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3323
4048
  <fo:inline font-style="italic">
3324
4049
  <xsl:apply-templates/>
3325
4050
  </fo:inline>
3326
4051
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4052
+ <xsl:param name="split_keep-within-line"/>
3327
4053
  <fo:inline font-weight="bold">
3328
4054
 
3329
- <xsl:apply-templates/>
4055
+ <xsl:apply-templates>
4056
+ <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4057
+ </xsl:apply-templates>
3330
4058
  </fo:inline>
3331
4059
  </xsl:template><xsl:template match="*[local-name()='padding']">
3332
4060
  <fo:inline padding-right="{@value}"> </fo:inline>
@@ -3347,7 +4075,7 @@
3347
4075
 
3348
4076
 
3349
4077
 
3350
-
4078
+ <!-- 10 -->
3351
4079
 
3352
4080
 
3353
4081
 
@@ -3365,13 +4093,15 @@
3365
4093
  <xsl:choose>
3366
4094
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3367
4095
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3368
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4096
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3369
4097
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3370
4098
  </xsl:choose>
3371
4099
  </xsl:attribute>
3372
4100
  </xsl:if>
3373
4101
  <xsl:apply-templates/>
3374
4102
  </fo:inline>
4103
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4104
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3375
4105
  </xsl:template><xsl:template match="*[local-name()='underline']">
3376
4106
  <fo:inline text-decoration="underline">
3377
4107
  <xsl:apply-templates/>
@@ -3519,54 +4249,120 @@
3519
4249
  <fo:block break-after="page"/>
3520
4250
  <fo:block> </fo:block>
3521
4251
  <fo:block break-after="page"/>
4252
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4253
+ <xsl:apply-templates/>
3522
4254
  </xsl:template><xsl:template name="tokenize">
3523
4255
  <xsl:param name="text"/>
3524
4256
  <xsl:param name="separator" select="' '"/>
3525
4257
  <xsl:choose>
4258
+
4259
+ <xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
4260
+ <word><xsl:value-of select="normalize-space($text)"/></word>
4261
+ </xsl:when>
3526
4262
  <xsl:when test="not(contains($text, $separator))">
3527
4263
  <word>
3528
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3529
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3530
4264
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3531
- <xsl:variable name="len_str">
3532
- <xsl:choose>
3533
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3534
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3535
- </xsl:when>
3536
- <xsl:otherwise>
3537
- <xsl:value-of select="$len_str_tmp"/>
3538
- </xsl:otherwise>
3539
- </xsl:choose>
3540
- </xsl:variable>
3541
-
3542
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3543
- <xsl:message>
3544
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3545
- len_str=<xsl:value-of select="$len_str"/>
3546
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3547
- </xsl:message>
3548
- </xsl:if> -->
3549
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3550
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3551
4265
  <xsl:choose>
3552
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3553
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4266
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4267
+ <xsl:value-of select="$len_str_tmp"/>
3554
4268
  </xsl:when>
3555
4269
  <xsl:otherwise>
3556
- <xsl:value-of select="$len_str"/>
4270
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4271
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4272
+ <xsl:variable name="len_str">
4273
+ <xsl:choose>
4274
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4275
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4276
+ </xsl:when>
4277
+ <xsl:otherwise>
4278
+ <xsl:value-of select="$len_str_tmp"/>
4279
+ </xsl:otherwise>
4280
+ </xsl:choose>
4281
+ </xsl:variable>
4282
+
4283
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4284
+ <xsl:message>
4285
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4286
+ len_str=<xsl:value-of select="$len_str"/>
4287
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4288
+ </xsl:message>
4289
+ </xsl:if> -->
4290
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4291
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4292
+ <xsl:choose>
4293
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4294
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4295
+ </xsl:when>
4296
+ <xsl:otherwise>
4297
+ <xsl:value-of select="$len_str"/>
4298
+ </xsl:otherwise>
4299
+ </xsl:choose>
3557
4300
  </xsl:otherwise>
3558
4301
  </xsl:choose>
3559
4302
  </word>
3560
4303
  </xsl:when>
3561
4304
  <xsl:otherwise>
3562
4305
  <word>
3563
- <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
4306
+ <xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
4307
+ <xsl:choose>
4308
+ <xsl:when test="$isGenerateTableIF = 'true'">
4309
+ <xsl:value-of select="$word"/>
4310
+ </xsl:when>
4311
+ <xsl:otherwise>
4312
+ <xsl:value-of select="string-length($word)"/>
4313
+ </xsl:otherwise>
4314
+ </xsl:choose>
3564
4315
  </word>
3565
4316
  <xsl:call-template name="tokenize">
3566
4317
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3567
4318
  </xsl:call-template>
3568
4319
  </xsl:otherwise>
3569
4320
  </xsl:choose>
4321
+ </xsl:template><xsl:template name="tokenize_with_tags">
4322
+ <xsl:param name="tags"/>
4323
+ <xsl:param name="text"/>
4324
+ <xsl:param name="separator" select="' '"/>
4325
+ <xsl:choose>
4326
+
4327
+ <xsl:when test="not(contains($text, $separator))">
4328
+ <word>
4329
+ <xsl:call-template name="enclose_text_in_tags">
4330
+ <xsl:with-param name="text" select="normalize-space($text)"/>
4331
+ <xsl:with-param name="tags" select="$tags"/>
4332
+ </xsl:call-template>
4333
+ </word>
4334
+ </xsl:when>
4335
+ <xsl:otherwise>
4336
+ <word>
4337
+ <xsl:call-template name="enclose_text_in_tags">
4338
+ <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
4339
+ <xsl:with-param name="tags" select="$tags"/>
4340
+ </xsl:call-template>
4341
+ </word>
4342
+ <xsl:call-template name="tokenize_with_tags">
4343
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4344
+ </xsl:call-template>
4345
+ </xsl:otherwise>
4346
+ </xsl:choose>
4347
+ </xsl:template><xsl:template name="enclose_text_in_tags">
4348
+ <xsl:param name="text"/>
4349
+ <xsl:param name="tags"/>
4350
+ <xsl:param name="num">1</xsl:param> <!-- default (start) value -->
4351
+
4352
+ <xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
4353
+
4354
+ <xsl:choose>
4355
+ <xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
4356
+ <xsl:otherwise>
4357
+ <xsl:element name="{$tag_name}">
4358
+ <xsl:call-template name="enclose_text_in_tags">
4359
+ <xsl:with-param name="text" select="$text"/>
4360
+ <xsl:with-param name="tags" select="$tags"/>
4361
+ <xsl:with-param name="num" select="$num + 1"/>
4362
+ </xsl:call-template>
4363
+ </xsl:element>
4364
+ </xsl:otherwise>
4365
+ </xsl:choose>
3570
4366
  </xsl:template><xsl:template name="max_length">
3571
4367
  <xsl:param name="words"/>
3572
4368
  <xsl:for-each select="$words//word">
@@ -3667,12 +4463,19 @@
3667
4463
  </xsl:otherwise>
3668
4464
  </xsl:choose>
3669
4465
  </xsl:template><xsl:template name="getSimpleTable">
4466
+ <xsl:param name="id"/>
4467
+
3670
4468
  <xsl:variable name="simple-table">
3671
4469
 
4470
+ <!-- Step 0. replace <br/> to <p>...</p> -->
4471
+ <xsl:variable name="table_without_br">
4472
+ <xsl:apply-templates mode="table-without-br"/>
4473
+ </xsl:variable>
4474
+
3672
4475
  <!-- Step 1. colspan processing -->
3673
4476
  <xsl:variable name="simple-table-colspan">
3674
4477
  <tbody>
3675
- <xsl:apply-templates mode="simple-table-colspan"/>
4478
+ <xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
3676
4479
  </tbody>
3677
4480
  </xsl:variable>
3678
4481
 
@@ -3681,10 +4484,67 @@
3681
4484
  <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3682
4485
  </xsl:variable>
3683
4486
 
3684
- <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3685
-
4487
+ <!-- Step 3: add id to each cell -->
4488
+ <!-- add <word>...</word> for each word, image, math -->
4489
+ <xsl:variable name="simple-table-id">
4490
+ <xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
4491
+ <xsl:with-param name="id" select="$id"/>
4492
+ </xsl:apply-templates>
4493
+ </xsl:variable>
4494
+
4495
+ <xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
4496
+
3686
4497
  </xsl:variable>
3687
4498
  <xsl:copy-of select="$simple-table"/>
4499
+ </xsl:template><xsl:template match="@*|node()" mode="table-without-br">
4500
+ <xsl:copy>
4501
+ <xsl:apply-templates select="@*|node()" mode="table-without-br"/>
4502
+ </xsl:copy>
4503
+ </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">
4504
+ <xsl:copy>
4505
+ <xsl:copy-of select="@*"/>
4506
+ <p>
4507
+ <xsl:copy-of select="node()"/>
4508
+ </p>
4509
+ </xsl:copy>
4510
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
4511
+ <xsl:copy>
4512
+ <xsl:copy-of select="@*"/>
4513
+ <xsl:for-each select="*[local-name()='br']">
4514
+ <xsl:variable name="current_id" select="generate-id()"/>
4515
+ <p>
4516
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4517
+ <xsl:copy-of select="."/>
4518
+ </xsl:for-each>
4519
+ </p>
4520
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4521
+ <p>
4522
+ <xsl:for-each select="following-sibling::node()">
4523
+ <xsl:copy-of select="."/>
4524
+ </xsl:for-each>
4525
+ </p>
4526
+ </xsl:if>
4527
+ </xsl:for-each>
4528
+ </xsl:copy>
4529
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
4530
+ <xsl:for-each select="*[local-name()='br']">
4531
+ <xsl:variable name="current_id" select="generate-id()"/>
4532
+ <p>
4533
+ <xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
4534
+ <xsl:copy-of select="."/>
4535
+ </xsl:for-each>
4536
+ </p>
4537
+ <xsl:if test="not(following-sibling::*[local-name() = 'br'])">
4538
+ <p>
4539
+ <xsl:for-each select="following-sibling::node()">
4540
+ <xsl:copy-of select="."/>
4541
+ </xsl:for-each>
4542
+ </p>
4543
+ </xsl:if>
4544
+ </xsl:for-each>
4545
+ </xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4546
+ <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
4547
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
3688
4548
  </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3689
4549
  <xsl:apply-templates mode="simple-table-colspan"/>
3690
4550
  </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">
@@ -3774,6 +4634,126 @@
3774
4634
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3775
4635
  <xsl:with-param name="previousRow" select="$newRow"/>
3776
4636
  </xsl:apply-templates>
4637
+ </xsl:template><xsl:template match="/" mode="simple-table-id">
4638
+ <xsl:param name="id"/>
4639
+ <xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
4640
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4641
+ <xsl:with-param name="id" select="$id_prefixed"/>
4642
+ </xsl:apply-templates>
4643
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
4644
+ <xsl:param name="id"/>
4645
+ <xsl:copy>
4646
+ <xsl:apply-templates select="@*|node()" mode="simple-table-id">
4647
+ <xsl:with-param name="id" select="$id"/>
4648
+ </xsl:apply-templates>
4649
+ </xsl:copy>
4650
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
4651
+ <xsl:param name="id"/>
4652
+ <xsl:copy>
4653
+ <xsl:copy-of select="@*"/>
4654
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4655
+ <xsl:apply-templates select="node()" mode="simple-table-id">
4656
+ <xsl:with-param name="id" select="$id"/>
4657
+ </xsl:apply-templates>
4658
+ </xsl:copy>
4659
+ </xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
4660
+ <xsl:param name="id"/>
4661
+ <xsl:copy>
4662
+ <xsl:copy-of select="@*"/>
4663
+ <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
4664
+ <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4665
+ <xsl:attribute name="id">
4666
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4667
+ </xsl:attribute>
4668
+
4669
+ <xsl:for-each select="*[local-name() = 'p']">
4670
+ <xsl:copy>
4671
+ <xsl:copy-of select="@*"/>
4672
+ <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
4673
+ <xsl:attribute name="id">
4674
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4675
+ </xsl:attribute>
4676
+
4677
+ <xsl:copy-of select="node()"/>
4678
+ </xsl:copy>
4679
+ </xsl:for-each>
4680
+
4681
+
4682
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
4683
+
4684
+ <xsl:variable name="td_text">
4685
+ <xsl:apply-templates select="." mode="td_text_with_formatting"/>
4686
+ </xsl:variable>
4687
+
4688
+ <!-- td_text='<xsl:copy-of select="$td_text"/>' -->
4689
+
4690
+ <xsl:variable name="words">
4691
+ <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
4692
+ <word>
4693
+ <xsl:copy-of select="."/>
4694
+ </word>
4695
+ </xsl:for-each>
4696
+
4697
+ <xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
4698
+ <xsl:copy-of select="."/>
4699
+ </xsl:for-each>
4700
+
4701
+ </xsl:variable>
4702
+
4703
+ <xsl:for-each select="xalan:nodeset($words)/word">
4704
+ <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
4705
+ <xsl:copy>
4706
+ <xsl:attribute name="id">
4707
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
4708
+ </xsl:attribute>
4709
+ <xsl:copy-of select="node()"/>
4710
+ </xsl:copy>
4711
+ </xsl:for-each>
4712
+ </xsl:if>
4713
+ </xsl:copy>
4714
+
4715
+ </xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
4716
+ <xsl:copy>
4717
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
4718
+ </xsl:copy>
4719
+ </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">
4720
+ <xsl:variable name="formatting_tags">
4721
+ <xsl:call-template name="getFormattingTags"/>
4722
+ </xsl:variable>
4723
+ <word>
4724
+ <xsl:call-template name="enclose_text_in_tags">
4725
+ <xsl:with-param name="text" select="normalize-space(.)"/>
4726
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4727
+ </xsl:call-template>
4728
+ </word>
4729
+ </xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
4730
+
4731
+ <xsl:variable name="td_text" select="."/>
4732
+
4733
+ <xsl:variable name="string_with_added_zerospaces">
4734
+ <xsl:call-template name="add-zero-spaces-java">
4735
+ <xsl:with-param name="text" select="$td_text"/>
4736
+ </xsl:call-template>
4737
+ </xsl:variable>
4738
+
4739
+ <xsl:variable name="formatting_tags">
4740
+ <xsl:call-template name="getFormattingTags"/>
4741
+ </xsl:variable>
4742
+
4743
+ <!-- <word>text</word> -->
4744
+ <xsl:call-template name="tokenize_with_tags">
4745
+ <xsl:with-param name="tags" select="$formatting_tags"/>
4746
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
4747
+ </xsl:call-template>
4748
+ </xsl:template><xsl:template name="getFormattingTags">
4749
+ <tags>
4750
+ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
4751
+ <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
4752
+ <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
4753
+ <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
4754
+ <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
4755
+ <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
4756
+ </tags>
3777
4757
  </xsl:template><xsl:template name="getLang">
3778
4758
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3779
4759
  <xsl:variable name="language">
@@ -3828,55 +4808,90 @@
3828
4808
  <xsl:variable name="isDeleted" select="@deleted"/>
3829
4809
 
3830
4810
  <fo:inline xsl:use-attribute-sets="mathml-style">
4811
+
4812
+
4813
+
4814
+
4815
+
4816
+ <xsl:call-template name="setTrackChangesStyles">
4817
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4818
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4819
+ </xsl:call-template>
4820
+
4821
+ <xsl:if test="$add_math_as_text = 'true'">
4822
+ <!-- insert helper tag -->
4823
+ <!-- set unique font-size (fiction) -->
4824
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4825
+ <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 -->
4826
+ </xsl:if>
4827
+
4828
+ <xsl:variable name="mathml_content">
4829
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4830
+ </xsl:variable>
4831
+
4832
+
4833
+ <xsl:call-template name="mathml_instream_object">
4834
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4835
+ </xsl:call-template>
4836
+
4837
+
4838
+ </fo:inline>
4839
+ </xsl:template><xsl:template name="getMathml_comment_text">
4840
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4841
+ <xsl:variable name="comment_text_">
4842
+ <xsl:choose>
4843
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4844
+ <xsl:value-of select="$comment_text_following"/>
4845
+ </xsl:when>
4846
+ <xsl:otherwise>
4847
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4848
+ </xsl:otherwise>
4849
+ </xsl:choose>
4850
+ </xsl:variable>
4851
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4852
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4853
+ <xsl:value-of select="$comment_text"/>
4854
+ </xsl:template><xsl:template name="mathml_instream_object">
4855
+ <xsl:param name="comment_text"/>
4856
+ <xsl:param name="mathml_content"/>
4857
+
4858
+ <xsl:variable name="comment_text_">
4859
+ <xsl:choose>
4860
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4861
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4862
+ </xsl:choose>
4863
+ </xsl:variable>
4864
+
4865
+ <xsl:variable name="mathml">
4866
+ <xsl:apply-templates select="." mode="mathml"/>
4867
+ </xsl:variable>
3831
4868
 
4869
+ <fo:instream-foreign-object fox:alt-text="Math">
4870
+
3832
4871
 
3833
- <xsl:call-template name="setTrackChangesStyles">
3834
- <xsl:with-param name="isAdded" select="$isAdded"/>
3835
- <xsl:with-param name="isDeleted" select="$isDeleted"/>
3836
- </xsl:call-template>
3837
4872
 
3838
4873
 
3839
4874
 
3840
- <xsl:variable name="mathml">
3841
- <xsl:apply-templates select="." mode="mathml"/>
3842
- </xsl:variable>
3843
- <fo:instream-foreign-object fox:alt-text="Math">
3844
4875
 
3845
-
3846
-
3847
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3848
- <xsl:variable name="comment_text_">
3849
- <xsl:choose>
3850
- <xsl:when test="normalize-space($comment_text_following) != ''">
3851
- <xsl:value-of select="$comment_text_following"/>
3852
- </xsl:when>
3853
- <xsl:otherwise>
3854
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3855
- </xsl:otherwise>
3856
- </xsl:choose>
3857
- </xsl:variable>
3858
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3859
-
3860
- <xsl:if test="normalize-space($comment_text) != ''">
3861
- <!-- put Mathin Alternate Text -->
3862
- <xsl:attribute name="fox:alt-text">
3863
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3864
- </xsl:attribute>
3865
- </xsl:if>
3866
-
3867
- <xsl:variable name="mathml_content">
3868
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
3869
- </xsl:variable>
3870
- <!-- put MathML in Actual Text -->
3871
- <xsl:attribute name="fox:actual-text">
3872
- <xsl:value-of select="$mathml_content"/>
4876
+
4877
+ <!-- put MathML in Actual Text -->
4878
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4879
+ <xsl:attribute name="fox:actual-text">
4880
+ <xsl:value-of select="$mathml_content"/>
4881
+ </xsl:attribute>
4882
+
4883
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4884
+ <xsl:if test="normalize-space($comment_text_) != ''">
4885
+ <!-- put Mathin Alternate Text -->
4886
+ <xsl:attribute name="fox:alt-text">
4887
+ <xsl:value-of select="$comment_text_"/>
3873
4888
  </xsl:attribute>
3874
-
3875
-
3876
-
3877
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
3878
- </fo:instream-foreign-object>
3879
- </fo:inline>
4889
+ </xsl:if>
4890
+ <!-- </xsl:if> -->
4891
+
4892
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4893
+
4894
+ </fo:instream-foreign-object>
3880
4895
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3881
4896
  <!-- <xsl:text>a+b</xsl:text> -->
3882
4897
  <xsl:text>&lt;</xsl:text>
@@ -3907,7 +4922,9 @@
3907
4922
  <!-- replace start and end spaces to non-break space -->
3908
4923
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3909
4924
  </xsl:copy>
3910
- </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">
4925
+ </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">
4926
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
4927
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3911
4928
  <xsl:variable name="target">
3912
4929
  <xsl:choose>
3913
4930
  <xsl:when test="@updatetype = 'true'">
@@ -4502,18 +5519,33 @@
4502
5519
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4503
5520
  <xsl:copy>
4504
5521
  <xsl:apply-templates select="@*" mode="svg_update"/>
4505
- <xsl:variable name="viewbox">
5522
+ <xsl:variable name="viewbox_">
4506
5523
  <xsl:call-template name="split">
4507
5524
  <xsl:with-param name="pText" select="@viewBox"/>
4508
5525
  <xsl:with-param name="sep" select="' '"/>
4509
5526
  </xsl:call-template>
4510
5527
  </xsl:variable>
5528
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5529
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5530
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5531
+
4511
5532
  <xsl:attribute name="width">
4512
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5533
+ <xsl:choose>
5534
+ <xsl:when test="$width != ''">
5535
+ <xsl:value-of select="round($width)"/>
5536
+ </xsl:when>
5537
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5538
+ </xsl:choose>
4513
5539
  </xsl:attribute>
4514
5540
  <xsl:attribute name="height">
4515
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5541
+ <xsl:choose>
5542
+ <xsl:when test="$height != ''">
5543
+ <xsl:value-of select="round($height)"/>
5544
+ </xsl:when>
5545
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5546
+ </xsl:choose>
4516
5547
  </xsl:attribute>
5548
+
4517
5549
  <xsl:apply-templates mode="svg_update"/>
4518
5550
  </xsl:copy>
4519
5551
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4708,7 +5740,11 @@
4708
5740
  <xsl:apply-templates mode="bookmarks"/>
4709
5741
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4710
5742
  <xsl:apply-templates select="."/>
4711
- </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">
5743
+ </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">
5744
+ <xsl:apply-templates mode="contents"/>
5745
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5746
+ <xsl:apply-templates mode="bookmarks"/>
5747
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4712
5748
  <xsl:apply-templates mode="bookmarks"/>
4713
5749
  </xsl:template><xsl:template name="addBookmarks">
4714
5750
  <xsl:param name="contents"/>
@@ -4990,7 +6026,9 @@
4990
6026
  <xsl:apply-templates/>
4991
6027
  </xsl:otherwise>
4992
6028
  </xsl:choose>
4993
- </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">
6029
+ </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">
6030
+ <xsl:value-of select="."/>
6031
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
4994
6032
  <xsl:text> </xsl:text>
4995
6033
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
4996
6034
  <xsl:copy>
@@ -5021,9 +6059,22 @@
5021
6059
  </xsl:when>
5022
6060
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5023
6061
  </xsl:choose>
6062
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6063
+ <xsl:call-template name="keep_together_standard_number"/>
6064
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6065
+ <xsl:apply-templates mode="contents_item"/>
5024
6066
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5025
6067
 
5026
6068
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6069
+
6070
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6071
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6072
+ </xsl:if>
6073
+
6074
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6075
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6076
+ </xsl:if>
6077
+
5027
6078
  <xsl:copy-of select="@id"/>
5028
6079
 
5029
6080
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5048,7 +6099,7 @@
5048
6099
 
5049
6100
 
5050
6101
 
5051
-
6102
+ <!-- 9 -->
5052
6103
 
5053
6104
 
5054
6105
 
@@ -5132,7 +6183,7 @@
5132
6183
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5133
6184
  <xsl:choose>
5134
6185
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5135
- <xsl:call-template name="interspers">
6186
+ <xsl:call-template name="interspers-java">
5136
6187
  <xsl:with-param name="str" select="."/>
5137
6188
  </xsl:call-template>
5138
6189
  </xsl:when>
@@ -5182,6 +6233,10 @@
5182
6233
  <xsl:with-param name="char" select="$char"/>
5183
6234
  </xsl:call-template>
5184
6235
  </xsl:if>
6236
+ </xsl:template><xsl:template name="interspers-java">
6237
+ <xsl:param name="str"/>
6238
+ <xsl:param name="char" select="$zero_width_space"/>
6239
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
5185
6240
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
5186
6241
  <xsl:apply-templates mode="syntax_highlight"/>
5187
6242
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -5394,7 +6449,9 @@
5394
6449
  <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
5395
6450
  </xsl:if>
5396
6451
  <xsl:variable name="simple-table">
5397
- <xsl:call-template name="getSimpleTable"/>
6452
+ <xsl:call-template name="getSimpleTable">
6453
+ <xsl:with-param name="id" select="@id"/>
6454
+ </xsl:call-template>
5398
6455
  </xsl:variable>
5399
6456
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
5400
6457
  <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
@@ -5501,39 +6558,67 @@
5501
6558
  </xsl:otherwise>
5502
6559
  </xsl:choose>
5503
6560
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5504
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5505
-
6561
+
6562
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6563
+
5506
6564
 
6565
+
5507
6566
  <xsl:variable name="fo_element">
5508
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6567
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5509
6568
  block
5510
6569
  </xsl:variable>
5511
6570
 
5512
- <!-- display 'EXAMPLE' -->
5513
- <xsl:apply-templates select="*[local-name()='name']">
5514
- <xsl:with-param name="fo_element" select="$fo_element"/>
5515
- </xsl:apply-templates>
6571
+ <fo:block-container margin-left="0mm">
5516
6572
 
5517
- <xsl:choose>
5518
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5519
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5520
- <fo:block-container margin-left="0mm" margin-right="0mm">
5521
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6573
+ <xsl:choose>
6574
+
6575
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6576
+
6577
+ <!-- display name 'EXAMPLE' in a separate block -->
6578
+ <fo:block>
6579
+ <xsl:apply-templates select="*[local-name()='name']">
5522
6580
  <xsl:with-param name="fo_element" select="$fo_element"/>
5523
6581
  </xsl:apply-templates>
6582
+ </fo:block>
6583
+
6584
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6585
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6586
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6587
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6588
+ </xsl:apply-templates>
6589
+ </fo:block-container>
5524
6590
  </fo:block-container>
5525
- </fo:block-container>
5526
- </xsl:when>
5527
- <xsl:otherwise>
5528
- <fo:inline>
5529
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5530
- <xsl:with-param name="fo_element" select="$fo_element"/>
5531
- </xsl:apply-templates>
5532
- </fo:inline>
5533
- </xsl:otherwise>
5534
- </xsl:choose>
5535
-
5536
- </fo:block>
6591
+ </xsl:when> <!-- end block -->
6592
+
6593
+ <xsl:otherwise> <!-- inline -->
6594
+
6595
+ <!-- display 'EXAMPLE' and first element in the same line -->
6596
+ <fo:block>
6597
+ <xsl:apply-templates select="*[local-name()='name']">
6598
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6599
+ </xsl:apply-templates>
6600
+ <fo:inline>
6601
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6602
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6603
+ </xsl:apply-templates>
6604
+ </fo:inline>
6605
+ </fo:block>
6606
+
6607
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6608
+ <!-- display further elements in blocks -->
6609
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6610
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6611
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6612
+ <xsl:with-param name="fo_element" select="'block'"/>
6613
+ </xsl:apply-templates>
6614
+ </fo:block-container>
6615
+ </fo:block-container>
6616
+ </xsl:if>
6617
+ </xsl:otherwise> <!-- end inline -->
6618
+
6619
+ </xsl:choose>
6620
+ </fo:block-container>
6621
+ </fo:block-container>
5537
6622
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5538
6623
  <xsl:param name="fo_element">block</xsl:param>
5539
6624
 
@@ -5565,10 +6650,16 @@
5565
6650
  </xsl:variable>
5566
6651
  <xsl:choose>
5567
6652
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5568
- <fo:block xsl:use-attribute-sets="example-p-style">
5569
-
5570
- <xsl:apply-templates/>
5571
- </fo:block>
6653
+ <fo:block-container>
6654
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6655
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6656
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6657
+ </xsl:if>
6658
+ <fo:block xsl:use-attribute-sets="example-p-style">
6659
+
6660
+ <xsl:apply-templates/>
6661
+ </fo:block>
6662
+ </fo:block-container>
5572
6663
  </xsl:when>
5573
6664
  <xsl:otherwise>
5574
6665
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5747,7 +6838,16 @@
5747
6838
  </fo:inline>
5748
6839
  </xsl:when>
5749
6840
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5750
- <fo:inline><xsl:apply-templates/></fo:inline>
6841
+
6842
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6843
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6844
+ <xsl:choose>
6845
+ <xsl:when test="$uri_src != ''">
6846
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6847
+ </xsl:when>
6848
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6849
+ </xsl:choose>
6850
+
5751
6851
  </xsl:otherwise>
5752
6852
  </xsl:choose>
5753
6853
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -5923,10 +7023,24 @@
5923
7023
 
5924
7024
  </fo:block>
5925
7025
  <xsl:apply-templates/>
5926
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7026
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
5927
7027
  <!-- comment 2019-11-29 -->
5928
7028
  <!-- <fo:block font-weight="bold">Review:</fo:block>
5929
7029
  <xsl:apply-templates /> -->
7030
+
7031
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7032
+
7033
+ <xsl:choose>
7034
+ <!-- if there isn't the attribute '@from', then -->
7035
+ <xsl:when test="$id_from = ''">
7036
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7037
+ </xsl:when>
7038
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7039
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7040
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7041
+ </xsl:when>
7042
+ </xsl:choose>
7043
+
5930
7044
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5931
7045
  <!-- 0xA0 to space replacement -->
5932
7046
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6073,6 +7187,11 @@
6073
7187
  </xsl:otherwise>
6074
7188
  </xsl:choose>
6075
7189
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7190
+
7191
+ <xsl:apply-templates select="*[local-name() = 'name']">
7192
+ <xsl:with-param name="process">true</xsl:with-param>
7193
+ </xsl:apply-templates>
7194
+
6076
7195
  <fo:list-block xsl:use-attribute-sets="list-style">
6077
7196
 
6078
7197
 
@@ -6083,12 +7202,23 @@
6083
7202
 
6084
7203
 
6085
7204
 
7205
+ <xsl:if test="*[local-name() = 'name']">
7206
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7207
+ </xsl:if>
7208
+
6086
7209
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6087
7210
  </fo:list-block>
6088
7211
  <!-- <xsl:for-each select="./iho:note">
6089
7212
  <xsl:call-template name="note"/>
6090
7213
  </xsl:for-each> -->
6091
7214
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7215
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7216
+ <xsl:param name="process">false</xsl:param>
7217
+ <xsl:if test="$process = 'true'">
7218
+ <fo:block xsl:use-attribute-sets="list-name-style">
7219
+ <xsl:apply-templates/>
7220
+ </fo:block>
7221
+ </xsl:if>
6092
7222
  </xsl:template><xsl:template match="*[local-name()='li']">
6093
7223
  <fo:list-item xsl:use-attribute-sets="list-item-style">
6094
7224
  <xsl:copy-of select="@id"/>
@@ -6285,7 +7415,10 @@
6285
7415
  <!-- to split by '_' and other chars -->
6286
7416
  <xsl:call-template name="add-zero-spaces-java"/>
6287
7417
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6288
- <fo:inline id="{@id}" font-size="1pt"/>
7418
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7419
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7420
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7421
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
6289
7422
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6290
7423
  <!-- <row>
6291
7424
  <date>05-07-2013</date>
@@ -6357,108 +7490,52 @@
6357
7490
  </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
6358
7491
 
6359
7492
 
6360
- <fo:block xsl:use-attribute-sets="bibitem-non-normative-style">
6361
- <fo:inline id="{@id}">
7493
+ <!-- start CSA bibitem processing -->
7494
+ <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-style">
7495
+
7496
+ <xsl:variable name="docidentifier">
6362
7497
  <xsl:value-of select="csa:docidentifier[@type = 'metanorma-ordinal']"/>
6363
7498
  <xsl:if test="not(csa:docidentifier[@type = 'metanorma-ordinal'])">
6364
7499
  <xsl:number format="[1]"/>
6365
7500
  </xsl:if>
6366
- </fo:inline>
6367
-
6368
- <xsl:if test="not(csa:formattedref)">
6369
- <xsl:choose>
6370
- <xsl:when test="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:abbreviation">
6371
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:abbreviation">
6372
- <xsl:value-of select="."/>
6373
- <xsl:if test="position() != last()">/</xsl:if>
6374
- </xsl:for-each>
6375
- <xsl:text>: </xsl:text>
6376
- </xsl:when>
6377
- <xsl:when test="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
6378
- <xsl:value-of select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name"/>
6379
- <xsl:text>: </xsl:text>
6380
- </xsl:when>
6381
- </xsl:choose>
6382
-
6383
- </xsl:if>
6384
-
6385
- <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">
6386
- <xsl:choose>
6387
- <xsl:when test="csa:docidentifier/@type = 'ISO' and csa:formattedref"/>
6388
- <xsl:when test="csa:docidentifier/@type = 'OGC' and csa:formattedref"/>
6389
- <xsl:otherwise><fo:inline>
6390
- <!-- <xsl:if test="csa:docidentifier/@type = 'OGC'">OGC </xsl:if> -->
6391
- <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
6392
- </xsl:choose>
6393
- </xsl:if>
6394
-
6395
- <xsl:choose>
6396
- <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
6397
- <xsl:apply-templates select="csa:title[@type = 'main' and @language = 'en']"/>
6398
- </xsl:when>
6399
- <xsl:otherwise>
6400
- <xsl:apply-templates select="csa:title"/>
6401
- </xsl:otherwise>
6402
- </xsl:choose>
6403
- <xsl:if test="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
6404
- <xsl:text>, </xsl:text>
6405
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
6406
- <xsl:if test="position() != last()">and </xsl:if>
6407
- <xsl:value-of select="."/>
6408
- </xsl:for-each>
6409
-
6410
- </xsl:if>
6411
- <xsl:if test="csa:place">
6412
- <xsl:text>, </xsl:text>
6413
- <xsl:value-of select="csa:place"/>
6414
- </xsl:if>
6415
- <xsl:if test="csa:date[@type='published']/csa:on">
6416
- <xsl:text> (</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>).</xsl:text>
6417
- </xsl:if>
7501
+ </xsl:variable>
7502
+
7503
+ <xsl:value-of select="$docidentifier"/>
7504
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
7505
+ <xsl:text> </xsl:text>
7506
+
6418
7507
  <xsl:apply-templates select="csa:formattedref"/>
6419
7508
 
6420
7509
  </fo:block>
7510
+ <!-- END CSA bibitem processing -->
6421
7511
 
6422
7512
 
6423
7513
  </xsl:template><xsl:template name="processBibitem">
6424
7514
 
6425
7515
 
6426
- <!-- start CSA bibitem processing -->
6427
- <xsl:if test=".//csa:fn">
7516
+ <!-- start bibitem processing -->
7517
+ <xsl:if test=".//*[local-name() = 'fn']">
6428
7518
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
6429
7519
  </xsl:if>
6430
- <xsl:choose>
6431
- <xsl:when test="csa:formattedref">
6432
- <xsl:apply-templates select="csa:formattedref"/>
6433
- </xsl:when>
6434
- <xsl:otherwise>
6435
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
6436
- <xsl:apply-templates/>
6437
- <xsl:if test="position() != last()">, </xsl:if>
6438
- <xsl:if test="position() = last()">: </xsl:if>
6439
- </xsl:for-each>
6440
- <!-- csa:docidentifier -->
6441
- <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/>
6442
- <xsl:apply-templates select="csa:note"/>
6443
- <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">, </xsl:if>
6444
- <xsl:choose>
6445
- <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
6446
- <fo:inline><xsl:apply-templates select="csa:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text></fo:inline>
6447
- </xsl:when>
6448
- <xsl:otherwise>
6449
- <fo:inline><xsl:apply-templates select="csa:title"/><xsl:text>. </xsl:text></fo:inline>
6450
- </xsl:otherwise>
6451
- </xsl:choose>
6452
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
6453
- <xsl:apply-templates/>
6454
- <xsl:if test="position() != last()">, </xsl:if>
6455
- </xsl:for-each>
6456
- <xsl:if test="csa:date[@type='published']/csa:on">
6457
- <xsl:text>(</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>)</xsl:text>
6458
- </xsl:if>
6459
- </xsl:otherwise>
6460
- </xsl:choose>
6461
- <!-- end CSA bibitem processing -->
7520
+
7521
+ <!-- display document identifier, not number [1] -->
7522
+ <xsl:variable name="docidentifier">
7523
+ <xsl:choose>
7524
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
7525
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
7526
+ </xsl:choose>
7527
+ </xsl:variable>
7528
+ <xsl:value-of select="$docidentifier"/>
7529
+
7530
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
7531
+
7532
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
7533
+
7534
+ <xsl:text> </xsl:text>
7535
+ </xsl:if>
7536
+
7537
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
7538
+ <!-- end bibitem processing -->
6462
7539
 
6463
7540
  </xsl:template><xsl:template name="processBibitemDocId">
6464
7541
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
@@ -6784,25 +7861,32 @@
6784
7861
  </fo:block-container>
6785
7862
 
6786
7863
  </xsl:template><xsl:template name="displayAdmonitionName">
6787
-
7864
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
7865
+ <!-- <xsl:choose>
7866
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
7867
+ <xsl:choose>
7868
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
7869
+ <xsl:otherwise>
7870
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7871
+ </xsl:otherwise>
7872
+ </xsl:choose>
7873
+ </xsl:when>
7874
+ <xsl:otherwise>
6788
7875
  <xsl:apply-templates select="*[local-name() = 'name']"/>
6789
7876
  <xsl:if test="not(*[local-name() = 'name'])">
6790
7877
  <xsl:apply-templates select="@type"/>
6791
7878
  </xsl:if>
6792
-
6793
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
6794
- <xsl:apply-templates/>
6795
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
6796
- <xsl:variable name="admonition_type_">
6797
- <xsl:call-template name="getLocalizedString">
6798
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
6799
- </xsl:call-template>
7879
+ </xsl:otherwise>
7880
+ </xsl:choose> -->
7881
+ <xsl:variable name="name">
7882
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6800
7883
  </xsl:variable>
6801
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
6802
- <xsl:value-of select="$admonition_type"/>
6803
- <xsl:if test="$admonition_type = ''">
6804
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
7884
+ <xsl:copy-of select="$name"/>
7885
+ <xsl:if test="normalize-space($name) != ''">
7886
+ <xsl:value-of select="$sep"/>
6805
7887
  </xsl:if>
7888
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7889
+ <xsl:apply-templates/>
6806
7890
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
6807
7891
  <!-- processing for admonition/p found in the template for 'p' -->
6808
7892
  <xsl:call-template name="paragraph"/>
@@ -6879,6 +7963,120 @@
6879
7963
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6880
7964
  </xsl:for-each>
6881
7965
  </xsl:copy>
7966
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
7967
+ <xsl:apply-templates mode="update_xml_step1"/>
7968
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
7969
+ <xsl:copy>
7970
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
7971
+ </xsl:copy>
7972
+ </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">
7973
+
7974
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
7975
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
7976
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7977
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7978
+ <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))"/>
7979
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
7980
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7981
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7982
+ <xsl:with-param name="text" select="$text_"/>
7983
+ </xsl:call-template></text></xsl:variable>
7984
+
7985
+ <xsl:variable name="parent" select="local-name(..)"/>
7986
+
7987
+ <xsl:variable name="text2">
7988
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
7989
+ <xsl:copy-of select="."/>
7990
+ </xsl:for-each></text>
7991
+ </xsl:variable>
7992
+
7993
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
7994
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
7995
+ <xsl:variable name="text3">
7996
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
7997
+ <xsl:choose>
7998
+ <xsl:when test="self::text()">
7999
+ <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))"/>
8000
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8001
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8002
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8003
+ <xsl:with-param name="text" select="$text_units_"/>
8004
+ </xsl:call-template></text></xsl:variable>
8005
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8006
+ </xsl:when>
8007
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8008
+ </xsl:choose>
8009
+ </xsl:for-each></text>
8010
+ </xsl:variable>
8011
+
8012
+ <xsl:choose>
8013
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8014
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8015
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8016
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8017
+ <xsl:choose>
8018
+ <xsl:when test="self::text()">
8019
+ <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))"/>
8020
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8021
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8022
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8023
+ <xsl:with-param name="text" select="$text_dots_"/>
8024
+ </xsl:call-template></text></xsl:variable>
8025
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8026
+ </xsl:when>
8027
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8028
+ </xsl:choose>
8029
+ </xsl:for-each>
8030
+ </xsl:when>
8031
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8032
+ </xsl:choose>
8033
+
8034
+ </xsl:template><xsl:template name="replace_text_tags">
8035
+ <xsl:param name="tag_open"/>
8036
+ <xsl:param name="tag_close"/>
8037
+ <xsl:param name="text"/>
8038
+ <xsl:choose>
8039
+ <xsl:when test="contains($text, $tag_open)">
8040
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8041
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8042
+
8043
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8044
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8045
+ </xsl:element>
8046
+
8047
+ <xsl:call-template name="replace_text_tags">
8048
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8049
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8050
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8051
+ </xsl:call-template>
8052
+ </xsl:when>
8053
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8054
+ </xsl:choose>
8055
+ </xsl:template><xsl:template name="printEdition">
8056
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8057
+ <xsl:text> </xsl:text>
8058
+ <xsl:choose>
8059
+ <xsl:when test="$edition_i18n != ''">
8060
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8061
+ <xsl:call-template name="capitalize">
8062
+ <xsl:with-param name="str" select="$edition_i18n"/>
8063
+ </xsl:call-template>
8064
+ </xsl:when>
8065
+ <xsl:otherwise>
8066
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8067
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8068
+ <xsl:call-template name="capitalize">
8069
+ <xsl:with-param name="str">
8070
+ <xsl:call-template name="getLocalizedString">
8071
+ <xsl:with-param name="key">edition</xsl:with-param>
8072
+ </xsl:call-template>
8073
+ </xsl:with-param>
8074
+ </xsl:call-template>
8075
+ <xsl:text> </xsl:text>
8076
+ <xsl:value-of select="$edition"/>
8077
+ </xsl:if>
8078
+ </xsl:otherwise>
8079
+ </xsl:choose>
6882
8080
  </xsl:template><xsl:template name="convertDate">
6883
8081
  <xsl:param name="date"/>
6884
8082
  <xsl:param name="format" select="'short'"/>
@@ -7566,4 +8764,40 @@
7566
8764
  <xsl:value-of select="$value"/>
7567
8765
  </xsl:otherwise>
7568
8766
  </xsl:choose>
8767
+ </xsl:template><xsl:template match="*" mode="print_as_xml">
8768
+ <xsl:param name="level">0</xsl:param>
8769
+
8770
+ <fo:block margin-left="{2*$level}mm">
8771
+ <xsl:text>
8772
+ &lt;</xsl:text>
8773
+ <xsl:value-of select="local-name()"/>
8774
+ <xsl:for-each select="@*">
8775
+ <xsl:text> </xsl:text>
8776
+ <xsl:value-of select="local-name()"/>
8777
+ <xsl:text>="</xsl:text>
8778
+ <xsl:value-of select="."/>
8779
+ <xsl:text>"</xsl:text>
8780
+ </xsl:for-each>
8781
+ <xsl:text>&gt;</xsl:text>
8782
+
8783
+ <xsl:if test="not(*)">
8784
+ <fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
8785
+ <xsl:text>&lt;/</xsl:text>
8786
+ <xsl:value-of select="local-name()"/>
8787
+ <xsl:text>&gt;</xsl:text>
8788
+ </xsl:if>
8789
+ </fo:block>
8790
+
8791
+ <xsl:if test="*">
8792
+ <fo:block>
8793
+ <xsl:apply-templates mode="print_as_xml">
8794
+ <xsl:with-param name="level" select="$level + 1"/>
8795
+ </xsl:apply-templates>
8796
+ </fo:block>
8797
+ <fo:block margin-left="{2*$level}mm">
8798
+ <xsl:text>&lt;/</xsl:text>
8799
+ <xsl:value-of select="local-name()"/>
8800
+ <xsl:text>&gt;</xsl:text>
8801
+ </fo:block>
8802
+ </xsl:if>
7569
8803
  </xsl:template></xsl:stylesheet>