metanorma-cc 2.0.7 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/cc/cc.standard.xsl +1564 -283
- data/lib/isodoc/cc/html/html_cc_titlepage.html +2 -0
- data/lib/isodoc/cc/html/word_cc_titlepage.html +8 -3
- data/lib/isodoc/cc/init.rb +2 -2
- data/lib/metanorma/cc/biblio.rng +62 -10
- data/lib/metanorma/cc/isodoc.rng +56 -0
- data/lib/metanorma/cc/version.rb +1 -1
- data/metanorma-cc.gemspec +1 -1
- metadata +4 -4
@@ -32,7 +32,13 @@
|
|
32
32
|
|
33
33
|
<xsl:template match="/">
|
34
34
|
<xsl:call-template name="namespaceCheck"/>
|
35
|
-
<fo:root
|
35
|
+
<fo:root xml:lang="{$lang}">
|
36
|
+
<xsl:variable name="root-style">
|
37
|
+
<root-style xsl:use-attribute-sets="root-style"/>
|
38
|
+
</xsl:variable>
|
39
|
+
<xsl:call-template name="insertRootStyle">
|
40
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
41
|
+
</xsl:call-template>
|
36
42
|
<fo:layout-master-set>
|
37
43
|
<!-- Cover page -->
|
38
44
|
<fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
|
@@ -449,6 +455,7 @@
|
|
449
455
|
|
450
456
|
<xsl:template match="csd:p" name="paragraph">
|
451
457
|
<xsl:param name="inline" select="'false'"/>
|
458
|
+
<xsl:param name="split_keep-within-line"/>
|
452
459
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
453
460
|
<xsl:variable name="element-name">
|
454
461
|
<xsl:choose>
|
@@ -474,7 +481,9 @@
|
|
474
481
|
</xsl:choose>
|
475
482
|
</xsl:attribute>
|
476
483
|
<xsl:attribute name="line-height">115%</xsl:attribute>
|
477
|
-
<xsl:apply-templates
|
484
|
+
<xsl:apply-templates>
|
485
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
486
|
+
</xsl:apply-templates>
|
478
487
|
</xsl:element>
|
479
488
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
480
489
|
<fo:block margin-bottom="12pt">
|
@@ -560,7 +569,9 @@
|
|
560
569
|
</xsl:template>
|
561
570
|
|
562
571
|
|
563
|
-
<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="
|
572
|
+
<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:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
573
|
+
false
|
574
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
564
575
|
<xsl:call-template name="getLang"/>
|
565
576
|
</xsl:variable><xsl:variable name="pageWidth_">
|
566
577
|
210
|
@@ -575,20 +586,7 @@
|
|
575
586
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
576
587
|
20.3
|
577
588
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
578
|
-
|
579
|
-
<title-edition lang="en">
|
580
|
-
|
581
|
-
<xsl:text>Edition </xsl:text>
|
582
|
-
|
583
|
-
</title-edition>
|
584
|
-
|
585
|
-
<title-edition lang="fr">
|
586
|
-
<xsl:text>Édition </xsl:text>
|
587
|
-
</title-edition>
|
588
589
|
|
589
|
-
<title-edition lang="ru">
|
590
|
-
<xsl:text>Издание </xsl:text>
|
591
|
-
</title-edition>
|
592
590
|
|
593
591
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
594
592
|
<title-toc lang="en">
|
@@ -669,7 +667,7 @@
|
|
669
667
|
</xsl:variable><xsl:variable name="bibdata">
|
670
668
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
671
669
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
672
|
-
</xsl:variable><xsl:variable name="linebreak">
</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">
|
670
|
+
</xsl:variable><xsl:variable name="linebreak">
</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">
|
673
671
|
<xsl:param name="name"/>
|
674
672
|
<xsl:param name="lang"/>
|
675
673
|
<xsl:variable name="lang_">
|
@@ -712,7 +710,30 @@
|
|
712
710
|
|
713
711
|
|
714
712
|
|
715
|
-
</xsl:attribute-set><xsl:
|
713
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
714
|
+
<xsl:param name="root-style"/>
|
715
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
716
|
+
|
717
|
+
<xsl:variable name="additional_fonts_">
|
718
|
+
<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']">
|
719
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
720
|
+
</xsl:for-each>
|
721
|
+
</xsl:variable>
|
722
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
723
|
+
|
724
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
725
|
+
<xsl:choose>
|
726
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
727
|
+
<xsl:attribute name="{local-name()}">
|
728
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
729
|
+
</xsl:attribute>
|
730
|
+
</xsl:when>
|
731
|
+
<xsl:otherwise>
|
732
|
+
<xsl:copy-of select="."/>
|
733
|
+
</xsl:otherwise>
|
734
|
+
</xsl:choose>
|
735
|
+
</xsl:for-each>
|
736
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
716
737
|
|
717
738
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
718
739
|
|
@@ -769,7 +790,6 @@
|
|
769
790
|
|
770
791
|
|
771
792
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
772
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
773
793
|
|
774
794
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
775
795
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -856,6 +876,7 @@
|
|
856
876
|
|
857
877
|
|
858
878
|
|
879
|
+
|
859
880
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
860
881
|
|
861
882
|
|
@@ -1007,6 +1028,7 @@
|
|
1007
1028
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1008
1029
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1009
1030
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1031
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1010
1032
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1011
1033
|
|
1012
1034
|
|
@@ -1025,6 +1047,7 @@
|
|
1025
1047
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1026
1048
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1027
1049
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1050
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1028
1051
|
|
1029
1052
|
|
1030
1053
|
|
@@ -1109,7 +1132,8 @@
|
|
1109
1132
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
1110
1133
|
|
1111
1134
|
|
1112
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
1135
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
1136
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
1113
1137
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
1114
1138
|
|
1115
1139
|
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
@@ -1123,6 +1147,8 @@
|
|
1123
1147
|
|
1124
1148
|
|
1125
1149
|
|
1150
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
1151
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
1126
1152
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
1127
1153
|
|
1128
1154
|
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
@@ -1225,7 +1251,7 @@
|
|
1225
1251
|
|
1226
1252
|
|
1227
1253
|
|
1228
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
1254
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
1229
1255
|
|
1230
1256
|
|
1231
1257
|
|
@@ -1915,22 +1941,32 @@
|
|
1915
1941
|
<xsl:sort select="@displayorder" data-type="number"/>
|
1916
1942
|
<xsl:apply-templates select="."/>
|
1917
1943
|
</xsl:for-each>
|
1918
|
-
</xsl:template><xsl:variable name="
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1944
|
+
</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">
|
1945
|
+
|
1946
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
1947
|
+
<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))"/>
|
1948
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
1949
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
1950
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
1951
|
+
<xsl:with-param name="text" select="$text"/>
|
1952
|
+
</xsl:call-template>
|
1953
|
+
|
1954
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
1955
|
+
<xsl:param name="tag_open"/>
|
1956
|
+
<xsl:param name="tag_close"/>
|
1925
1957
|
<xsl:param name="text"/>
|
1926
1958
|
<xsl:choose>
|
1927
1959
|
<xsl:when test="contains($text, $tag_open)">
|
1928
1960
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
1929
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
1961
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
1930
1962
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
1931
|
-
<
|
1932
|
-
|
1933
|
-
|
1963
|
+
<fo:inline keep-together.within-line="always">
|
1964
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
1965
|
+
</fo:inline>
|
1966
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
1967
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
1968
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
1969
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
1934
1970
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
1935
1971
|
</xsl:call-template>
|
1936
1972
|
</xsl:when>
|
@@ -1938,6 +1974,39 @@
|
|
1938
1974
|
</xsl:choose>
|
1939
1975
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
1940
1976
|
<xsl:value-of select="$linebreak"/>
|
1977
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
1978
|
+
<xsl:param name="split_keep-within-line"/>
|
1979
|
+
|
1980
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
1981
|
+
<xsl:choose>
|
1982
|
+
|
1983
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
1984
|
+
<xsl:variable name="sep">_</xsl:variable>
|
1985
|
+
<xsl:variable name="items">
|
1986
|
+
<xsl:call-template name="split">
|
1987
|
+
<xsl:with-param name="pText" select="."/>
|
1988
|
+
<xsl:with-param name="sep" select="$sep"/>
|
1989
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
1990
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
1991
|
+
</xsl:call-template>
|
1992
|
+
</xsl:variable>
|
1993
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
1994
|
+
<xsl:choose>
|
1995
|
+
<xsl:when test=". = $sep">
|
1996
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
1997
|
+
</xsl:when>
|
1998
|
+
<xsl:otherwise>
|
1999
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2000
|
+
</xsl:otherwise>
|
2001
|
+
</xsl:choose>
|
2002
|
+
</xsl:for-each>
|
2003
|
+
</xsl:when>
|
2004
|
+
|
2005
|
+
<xsl:otherwise>
|
2006
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2007
|
+
</xsl:otherwise>
|
2008
|
+
|
2009
|
+
</xsl:choose>
|
1941
2010
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
1942
2011
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
1943
2012
|
<xsl:apply-templates/>
|
@@ -2003,8 +2072,23 @@
|
|
2003
2072
|
</xsl:call-template>
|
2004
2073
|
|
2005
2074
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
2006
|
-
|
2007
|
-
|
2075
|
+
<xsl:choose>
|
2076
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
2077
|
+
<xsl:value-of select="."/>
|
2078
|
+
</xsl:when>
|
2079
|
+
<xsl:otherwise>
|
2080
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
2081
|
+
</xsl:otherwise>
|
2082
|
+
</xsl:choose>
|
2083
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
2084
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
2085
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
2086
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
2087
|
+
<xsl:choose>
|
2088
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
2089
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
2090
|
+
</xsl:choose>
|
2091
|
+
</xsl:for-each>
|
2008
2092
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
2009
2093
|
|
2010
2094
|
<xsl:variable name="table-preamble">
|
@@ -2014,9 +2098,14 @@
|
|
2014
2098
|
|
2015
2099
|
<xsl:variable name="table">
|
2016
2100
|
|
2017
|
-
<xsl:variable name="simple-table">
|
2018
|
-
<xsl:call-template name="getSimpleTable"
|
2101
|
+
<xsl:variable name="simple-table">
|
2102
|
+
<xsl:call-template name="getSimpleTable">
|
2103
|
+
<xsl:with-param name="id" select="@id"/>
|
2104
|
+
</xsl:call-template>
|
2019
2105
|
</xsl:variable>
|
2106
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
2107
|
+
|
2108
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
2020
2109
|
|
2021
2110
|
|
2022
2111
|
<!-- Display table's name before table as standalone block -->
|
@@ -2039,7 +2128,23 @@
|
|
2039
2128
|
</xsl:call-template>
|
2040
2129
|
</xsl:if>
|
2041
2130
|
</xsl:variable>
|
2042
|
-
<!--
|
2131
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
2132
|
+
|
2133
|
+
<!-- DEBUG -->
|
2134
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2135
|
+
<fo:block font-size="60%">
|
2136
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
2137
|
+
</fo:block>
|
2138
|
+
</xsl:if>
|
2139
|
+
|
2140
|
+
|
2141
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
2142
|
+
|
2143
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
2144
|
+
DEBUG
|
2145
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
2146
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
2147
|
+
|
2043
2148
|
|
2044
2149
|
|
2045
2150
|
<xsl:variable name="margin-side">
|
@@ -2106,9 +2211,17 @@
|
|
2106
2211
|
</xsl:element>
|
2107
2212
|
</xsl:variable>
|
2108
2213
|
|
2214
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2215
|
+
<!-- to determine start of table -->
|
2216
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
2217
|
+
</xsl:if>
|
2109
2218
|
|
2110
2219
|
<fo:table id="{@id}">
|
2111
2220
|
|
2221
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2222
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
2223
|
+
</xsl:if>
|
2224
|
+
|
2112
2225
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
2113
2226
|
<xsl:attribute name="{local-name()}">
|
2114
2227
|
<xsl:value-of select="."/>
|
@@ -2122,31 +2235,47 @@
|
|
2122
2235
|
|
2123
2236
|
|
2124
2237
|
<xsl:choose>
|
2125
|
-
<xsl:when test="
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2238
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
2239
|
+
<!-- generate IF for table widths -->
|
2240
|
+
<!-- example:
|
2241
|
+
<tr>
|
2242
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
2243
|
+
<p>Symbol</p>
|
2244
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
2245
|
+
</td>
|
2246
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
2247
|
+
<p>Description</p>
|
2248
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
2249
|
+
</td>
|
2250
|
+
</tr>
|
2251
|
+
-->
|
2252
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
2253
|
+
|
2129
2254
|
</xsl:when>
|
2130
2255
|
<xsl:otherwise>
|
2131
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
2132
|
-
<xsl:choose>
|
2133
|
-
<xsl:when test=". = 1 or . = 0">
|
2134
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
2135
|
-
</xsl:when>
|
2136
|
-
<xsl:otherwise>
|
2137
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2138
|
-
</xsl:otherwise>
|
2139
|
-
</xsl:choose>
|
2140
|
-
</xsl:for-each>
|
2141
|
-
</xsl:otherwise>
|
2142
|
-
</xsl:choose>
|
2143
2256
|
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2257
|
+
<xsl:choose>
|
2258
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
2259
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
2260
|
+
<fo:table-column column-width="{@width}"/>
|
2261
|
+
</xsl:for-each>
|
2262
|
+
</xsl:when>
|
2263
|
+
<xsl:otherwise>
|
2264
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2265
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2266
|
+
</xsl:call-template>
|
2267
|
+
</xsl:otherwise>
|
2268
|
+
</xsl:choose>
|
2269
|
+
|
2270
|
+
<xsl:choose>
|
2271
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
2272
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
2273
|
+
</xsl:when>
|
2274
|
+
<xsl:otherwise>
|
2275
|
+
<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 -->
|
2276
|
+
</xsl:otherwise>
|
2277
|
+
</xsl:choose>
|
2278
|
+
|
2150
2279
|
</xsl:otherwise>
|
2151
2280
|
</xsl:choose>
|
2152
2281
|
|
@@ -2249,11 +2378,22 @@
|
|
2249
2378
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
2250
2379
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
2251
2380
|
</xsl:template><xsl:template name="calculate-column-widths">
|
2381
|
+
<xsl:param name="table"/>
|
2382
|
+
<xsl:param name="cols-count"/>
|
2383
|
+
|
2384
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2385
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2386
|
+
<xsl:with-param name="table" select="$table"/>
|
2387
|
+
</xsl:call-template>
|
2388
|
+
|
2389
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
2252
2390
|
<xsl:param name="table"/>
|
2253
2391
|
<xsl:param name="cols-count"/>
|
2254
2392
|
<xsl:param name="curr-col" select="1"/>
|
2255
2393
|
<xsl:param name="width" select="0"/>
|
2256
2394
|
|
2395
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
2396
|
+
|
2257
2397
|
<xsl:if test="$curr-col <= $cols-count">
|
2258
2398
|
<xsl:variable name="widths">
|
2259
2399
|
<xsl:choose>
|
@@ -2291,16 +2431,22 @@
|
|
2291
2431
|
</xsl:for-each>
|
2292
2432
|
</xsl:when>
|
2293
2433
|
<xsl:otherwise>
|
2294
|
-
<xsl:
|
2434
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
2435
|
+
|
2436
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
2437
|
+
-->
|
2438
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
2295
2439
|
<xsl:variable name="td_text">
|
2296
2440
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
2297
2441
|
</xsl:variable>
|
2442
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
2298
2443
|
<xsl:variable name="words">
|
2299
2444
|
<xsl:variable name="string_with_added_zerospaces">
|
2300
2445
|
<xsl:call-template name="add-zero-spaces-java">
|
2301
2446
|
<xsl:with-param name="text" select="$td_text"/>
|
2302
2447
|
</xsl:call-template>
|
2303
2448
|
</xsl:variable>
|
2449
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
2304
2450
|
<xsl:call-template name="tokenize">
|
2305
2451
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
2306
2452
|
<!-- 2009 thinspace -->
|
@@ -2308,11 +2454,13 @@
|
|
2308
2454
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2309
2455
|
</xsl:call-template>
|
2310
2456
|
</xsl:variable>
|
2457
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
2311
2458
|
<xsl:variable name="max_length">
|
2312
2459
|
<xsl:call-template name="max_length">
|
2313
2460
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2314
2461
|
</xsl:call-template>
|
2315
2462
|
</xsl:variable>
|
2463
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
2316
2464
|
<width>
|
2317
2465
|
<xsl:variable name="divider">
|
2318
2466
|
<xsl:choose>
|
@@ -2331,6 +2479,8 @@
|
|
2331
2479
|
</xsl:choose>
|
2332
2480
|
</xsl:variable>
|
2333
2481
|
|
2482
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
2483
|
+
|
2334
2484
|
<column>
|
2335
2485
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
2336
2486
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -2339,29 +2489,327 @@
|
|
2339
2489
|
</xsl:if>
|
2340
2490
|
</xsl:for-each>
|
2341
2491
|
</column>
|
2342
|
-
<xsl:call-template name="calculate-column-widths">
|
2492
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2343
2493
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2344
2494
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
2345
2495
|
<xsl:with-param name="table" select="$table"/>
|
2346
2496
|
</xsl:call-template>
|
2347
2497
|
</xsl:if>
|
2498
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
2499
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
2500
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
2501
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
2502
|
+
|
2503
|
+
<!-- if all capitals english letters or digits -->
|
2504
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
2505
|
+
<xsl:call-template name="repeat">
|
2506
|
+
<xsl:with-param name="char" select="'X'"/>
|
2507
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
2508
|
+
</xsl:call-template>
|
2509
|
+
</xsl:if>
|
2348
2510
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
2349
2511
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
2350
2512
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
2351
2513
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
2352
2514
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
2353
2515
|
<xsl:value-of select="@target"/>
|
2354
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
2355
|
-
<xsl:
|
2356
|
-
<xsl:
|
2357
|
-
<xsl:
|
2358
|
-
<xsl:
|
2516
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
2517
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
2518
|
+
<xsl:variable name="mathml_">
|
2519
|
+
<xsl:for-each select="*">
|
2520
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
2521
|
+
<xsl:copy-of select="."/>
|
2522
|
+
</xsl:if>
|
2523
|
+
</xsl:for-each>
|
2524
|
+
</xsl:variable>
|
2525
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
2526
|
+
|
2527
|
+
<xsl:variable name="math_text">
|
2528
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
2529
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
2530
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
2531
|
+
</xsl:variable>
|
2532
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
2533
|
+
</xsl:if>
|
2534
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
2535
|
+
<xsl:param name="table"/>
|
2536
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
2537
|
+
|
2538
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
2539
|
+
|
2540
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
2541
|
+
|
2542
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
2543
|
+
|
2544
|
+
<!-- get current table id -->
|
2545
|
+
<xsl:variable name="table_id" select="@id"/>
|
2546
|
+
<!-- find table by id in the file 'table_widths' -->
|
2547
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
2548
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
2549
|
+
|
2550
|
+
|
2551
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
2552
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
2553
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
2554
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
2555
|
+
|
2556
|
+
<xsl:variable name="table_with_cell_widths_">
|
2557
|
+
<xsl:choose>
|
2558
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
2559
|
+
|
2560
|
+
<!-- Example: <column>10</column>
|
2561
|
+
<column>11</column>
|
2562
|
+
-->
|
2563
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
2564
|
+
</xsl:when>
|
2565
|
+
<xsl:otherwise>
|
2566
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
2567
|
+
</xsl:otherwise>
|
2568
|
+
</xsl:choose>
|
2569
|
+
</xsl:variable>
|
2570
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
2571
|
+
|
2572
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2573
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
2574
|
+
</xsl:if>
|
2575
|
+
|
2576
|
+
|
2577
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
2578
|
+
|
2579
|
+
<xsl:variable name="column_widths_">
|
2580
|
+
<!-- iteration of columns -->
|
2581
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
2582
|
+
<xsl:variable name="pos" select="position()"/>
|
2583
|
+
<column>
|
2584
|
+
<xsl:attribute name="width_max">
|
2585
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
2586
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2587
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2588
|
+
</xsl:for-each>
|
2589
|
+
</xsl:attribute>
|
2590
|
+
<xsl:attribute name="width_min">
|
2591
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
2592
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2593
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2594
|
+
</xsl:for-each>
|
2595
|
+
</xsl:attribute>
|
2596
|
+
</column>
|
2597
|
+
</xsl:for-each>
|
2598
|
+
</xsl:variable>
|
2599
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
2600
|
+
|
2601
|
+
<!-- <column_widths>
|
2602
|
+
<xsl:copy-of select="$column_widths"/>
|
2603
|
+
</column_widths> -->
|
2604
|
+
|
2605
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
2606
|
+
<xsl:variable name="table_widths_">
|
2607
|
+
<table>
|
2608
|
+
<xsl:attribute name="width_max">
|
2609
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
2610
|
+
</xsl:attribute>
|
2611
|
+
<xsl:attribute name="width_min">
|
2612
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
2613
|
+
</xsl:attribute>
|
2614
|
+
</table>
|
2615
|
+
</xsl:variable>
|
2616
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
2617
|
+
|
2618
|
+
<xsl:variable name="page_width">
|
2619
|
+
<xsl:choose>
|
2620
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
2621
|
+
<xsl:otherwise>75</xsl:otherwise>
|
2622
|
+
</xsl:choose>
|
2623
|
+
</xsl:variable>
|
2624
|
+
|
2625
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2626
|
+
<table_width>
|
2627
|
+
<xsl:copy-of select="$table_widths"/>
|
2628
|
+
</table_width>
|
2629
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
2630
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
2631
|
+
-->
|
2632
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
2633
|
+
</xsl:if>
|
2634
|
+
|
2635
|
+
|
2636
|
+
<!-- There are three cases: -->
|
2637
|
+
<xsl:choose>
|
2638
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
2639
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
2640
|
+
<!-- call old algorithm -->
|
2641
|
+
<case1/>
|
2642
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
2643
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2644
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2645
|
+
<xsl:with-param name="table" select="$table"/>
|
2646
|
+
</xsl:call-template>
|
2647
|
+
</xsl:when>
|
2648
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
2649
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
2650
|
+
<case2/>
|
2651
|
+
<autolayout/>
|
2652
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
2653
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
2654
|
+
</xsl:for-each>
|
2655
|
+
</xsl:when>
|
2656
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
2657
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
2658
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
2659
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
2660
|
+
Now set the column's width to the minimum width plus d times W over D.
|
2661
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
2662
|
+
<xsl:when test="($table_widths/table/@width_max > $page_width and $table_widths/table/@width_min < $page_width) or ($table_widths/table/@width_min >= $page_width)">
|
2663
|
+
<!-- difference between the available space and the minimum table width -->
|
2664
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
2665
|
+
<W><xsl:value-of select="$W"/></W>
|
2666
|
+
<!-- difference between maximum and minimum width of the table -->
|
2667
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
2668
|
+
<D><xsl:value-of select="$D"/></D>
|
2669
|
+
<case3/>
|
2670
|
+
<autolayout/>
|
2671
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
2672
|
+
<split_keep-within-line>true</split_keep-within-line>
|
2673
|
+
</xsl:if>
|
2674
|
+
<xsl:for-each select="$column_widths/column">
|
2675
|
+
<!-- difference between maximum and minimum width of that column. -->
|
2676
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
2677
|
+
<d><xsl:value-of select="$d"/></d>
|
2678
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
2679
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
2680
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
2681
|
+
<column divider="100">
|
2682
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
2683
|
+
</column>
|
2684
|
+
</xsl:for-each>
|
2685
|
+
|
2686
|
+
</xsl:when>
|
2687
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
2688
|
+
</xsl:choose>
|
2689
|
+
|
2690
|
+
|
2691
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
2692
|
+
<xsl:copy>
|
2693
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
2694
|
+
</xsl:copy>
|
2695
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
2696
|
+
<xsl:copy>
|
2697
|
+
<xsl:copy-of select="@*"/>
|
2698
|
+
|
2699
|
+
<!-- The maximum width is given by the widest line. -->
|
2700
|
+
<xsl:variable name="widths_max">
|
2701
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
2702
|
+
<xsl:call-template name="add_width"/>
|
2703
|
+
</xsl:for-each>
|
2704
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
2705
|
+
<xsl:call-template name="add_width"/>
|
2359
2706
|
</xsl:if>
|
2707
|
+
</xsl:variable>
|
2708
|
+
<xsl:variable name="width_max">
|
2709
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
2710
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2711
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2712
|
+
</xsl:for-each>
|
2713
|
+
</xsl:variable>
|
2714
|
+
<xsl:attribute name="width_max">
|
2715
|
+
<xsl:value-of select="$width_max"/>
|
2716
|
+
</xsl:attribute>
|
2717
|
+
|
2718
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
2719
|
+
<!-- To do: image width -->
|
2720
|
+
<xsl:variable name="td_text">
|
2721
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
2722
|
+
</xsl:variable>
|
2723
|
+
<xsl:variable name="words">
|
2724
|
+
<xsl:variable name="string_with_added_zerospaces">
|
2725
|
+
<xsl:call-template name="add-zero-spaces-java">
|
2726
|
+
<xsl:with-param name="text" select="$td_text"/>
|
2727
|
+
</xsl:call-template>
|
2728
|
+
</xsl:variable>
|
2729
|
+
<xsl:call-template name="tokenize">
|
2730
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2731
|
+
</xsl:call-template>
|
2732
|
+
</xsl:variable>
|
2733
|
+
|
2734
|
+
<xsl:variable name="max_word_length">
|
2735
|
+
<xsl:call-template name="max_length">
|
2736
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2737
|
+
</xsl:call-template>
|
2738
|
+
</xsl:variable>
|
2739
|
+
<xsl:variable name="width_min">
|
2740
|
+
<xsl:value-of select="$max_word_length"/>
|
2741
|
+
</xsl:variable>
|
2742
|
+
<xsl:attribute name="width_min">
|
2743
|
+
<xsl:value-of select="$width_min"/>
|
2744
|
+
</xsl:attribute>
|
2745
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
2746
|
+
<xsl:if test="$width_min > $width_max">
|
2747
|
+
<xsl:attribute name="width_max">
|
2748
|
+
<xsl:value-of select="$width_min"/>
|
2749
|
+
</xsl:attribute>
|
2750
|
+
</xsl:if>
|
2751
|
+
<xsl:if test="$width_min = 0">
|
2752
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
2753
|
+
</xsl:if>
|
2754
|
+
|
2755
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
2756
|
+
|
2757
|
+
</xsl:copy>
|
2758
|
+
</xsl:template><xsl:template name="add_width">
|
2759
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
2760
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
2761
|
+
|
2762
|
+
<xsl:variable name="p_text_len">
|
2763
|
+
<xsl:choose>
|
2764
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
2765
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
2766
|
+
</xsl:when>
|
2767
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
2768
|
+
</xsl:choose>
|
2769
|
+
</xsl:variable>
|
2770
|
+
|
2771
|
+
<xsl:variable name="math_addon_text">
|
2772
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
2773
|
+
<xsl:apply-templates mode="td_text"/>
|
2360
2774
|
</xsl:for-each>
|
2361
2775
|
</xsl:variable>
|
2776
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
2362
2777
|
|
2363
|
-
<xsl:
|
2364
|
-
|
2778
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
2779
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
2780
|
+
<xsl:copy>
|
2781
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
2782
|
+
</xsl:copy>
|
2783
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
2784
|
+
<xsl:copy>
|
2785
|
+
<xsl:copy-of select="@*"/>
|
2786
|
+
|
2787
|
+
<!-- The maximum width is given by the widest line. -->
|
2788
|
+
<xsl:attribute name="width_max">
|
2789
|
+
<xsl:for-each select="p_len">
|
2790
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2791
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2792
|
+
</xsl:for-each>
|
2793
|
+
</xsl:attribute>
|
2794
|
+
|
2795
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
2796
|
+
<xsl:variable name="width_min">
|
2797
|
+
<xsl:for-each select="word_len">
|
2798
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2799
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2800
|
+
</xsl:for-each>
|
2801
|
+
</xsl:variable>
|
2802
|
+
<xsl:attribute name="width_min">
|
2803
|
+
<xsl:value-of select="$width_min"/>
|
2804
|
+
</xsl:attribute>
|
2805
|
+
|
2806
|
+
<xsl:if test="$width_min = 0">
|
2807
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
2808
|
+
</xsl:if>
|
2809
|
+
|
2810
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
2811
|
+
|
2812
|
+
</xsl:copy>
|
2365
2813
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
2366
2814
|
<xsl:param name="cols-count"/>
|
2367
2815
|
<fo:table-header>
|
@@ -2446,16 +2894,10 @@
|
|
2446
2894
|
</xsl:for-each>
|
2447
2895
|
</xsl:when>
|
2448
2896
|
<xsl:otherwise>
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
</xsl:when>
|
2454
|
-
<xsl:otherwise>
|
2455
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2456
|
-
</xsl:otherwise>
|
2457
|
-
</xsl:choose>
|
2458
|
-
</xsl:for-each>
|
2897
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
2898
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2899
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2900
|
+
</xsl:call-template>
|
2459
2901
|
</xsl:otherwise>
|
2460
2902
|
</xsl:choose>
|
2461
2903
|
|
@@ -2532,6 +2974,52 @@
|
|
2532
2974
|
|
2533
2975
|
</fo:table-body>
|
2534
2976
|
|
2977
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
2978
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
2979
|
+
<xsl:apply-templates mode="process_table-if">
|
2980
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
2981
|
+
</xsl:apply-templates>
|
2982
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
2983
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
2984
|
+
|
2985
|
+
<fo:table-body>
|
2986
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
2987
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
2988
|
+
|
2989
|
+
<!-- iteration for each tr/td -->
|
2990
|
+
|
2991
|
+
<xsl:choose>
|
2992
|
+
<xsl:when test="$table_or_dl = 'table'">
|
2993
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
2994
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
2995
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
2996
|
+
<xsl:call-template name="td"/>
|
2997
|
+
</fo:table-row>
|
2998
|
+
</xsl:for-each>
|
2999
|
+
</xsl:when>
|
3000
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
3001
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
3002
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
3003
|
+
|
3004
|
+
<xsl:for-each select="*">
|
3005
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
3006
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3007
|
+
<xsl:choose>
|
3008
|
+
<xsl:when test="$is_dt">
|
3009
|
+
<xsl:call-template name="insert_dt_cell"/>
|
3010
|
+
</xsl:when>
|
3011
|
+
<xsl:otherwise>
|
3012
|
+
<xsl:call-template name="insert_dd_cell"/>
|
3013
|
+
</xsl:otherwise>
|
3014
|
+
</xsl:choose>
|
3015
|
+
</fo:table-row>
|
3016
|
+
</xsl:for-each>
|
3017
|
+
</xsl:for-each>
|
3018
|
+
</xsl:otherwise>
|
3019
|
+
</xsl:choose>
|
3020
|
+
|
3021
|
+
</xsl:for-each>
|
3022
|
+
</fo:table-body>
|
2535
3023
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
2536
3024
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
2537
3025
|
|
@@ -2618,7 +3106,7 @@
|
|
2618
3106
|
</xsl:choose>
|
2619
3107
|
</xsl:attribute>
|
2620
3108
|
</xsl:if>
|
2621
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
3109
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
2622
3110
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
2623
3111
|
<xsl:call-template name="setTextAlignment">
|
2624
3112
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -2652,11 +3140,24 @@
|
|
2652
3140
|
|
2653
3141
|
<xsl:call-template name="setTableCellAttributes"/>
|
2654
3142
|
|
3143
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3144
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
3145
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3146
|
+
</xsl:if>
|
3147
|
+
|
2655
3148
|
<fo:block>
|
2656
3149
|
|
3150
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3151
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3152
|
+
</xsl:if>
|
3153
|
+
|
3154
|
+
|
2657
3155
|
|
2658
3156
|
|
2659
3157
|
<xsl:apply-templates/>
|
3158
|
+
|
3159
|
+
<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"/> -->
|
3160
|
+
|
2660
3161
|
</fo:block>
|
2661
3162
|
</fo:table-cell>
|
2662
3163
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -2853,9 +3354,9 @@
|
|
2853
3354
|
<!-- current hierarchy is 'figure' element -->
|
2854
3355
|
<xsl:variable name="following_dl_colwidths">
|
2855
3356
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
2856
|
-
<xsl:variable name="
|
2857
|
-
<xsl:variable name="doc_ns">
|
2858
|
-
|
3357
|
+
<xsl:variable name="simple-table">
|
3358
|
+
<!-- <xsl:variable name="doc_ns">
|
3359
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
2859
3360
|
</xsl:variable>
|
2860
3361
|
<xsl:variable name="ns">
|
2861
3362
|
<xsl:choose>
|
@@ -2866,7 +3367,7 @@
|
|
2866
3367
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
2867
3368
|
</xsl:otherwise>
|
2868
3369
|
</xsl:choose>
|
2869
|
-
</xsl:variable>
|
3370
|
+
</xsl:variable> -->
|
2870
3371
|
|
2871
3372
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
2872
3373
|
<tbody>
|
@@ -2877,7 +3378,7 @@
|
|
2877
3378
|
|
2878
3379
|
<xsl:call-template name="calculate-column-widths">
|
2879
3380
|
<xsl:with-param name="cols-count" select="2"/>
|
2880
|
-
<xsl:with-param name="table" select="$
|
3381
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
2881
3382
|
</xsl:call-template>
|
2882
3383
|
|
2883
3384
|
</xsl:if>
|
@@ -2996,8 +3497,10 @@
|
|
2996
3497
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
2997
3498
|
</xsl:variable>
|
2998
3499
|
|
3500
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
3501
|
+
|
2999
3502
|
<xsl:choose>
|
3000
|
-
<xsl:when test="$
|
3503
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
3001
3504
|
|
3002
3505
|
<fo:block margin-bottom="12pt" text-align="left">
|
3003
3506
|
|
@@ -3012,7 +3515,7 @@
|
|
3012
3515
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
3013
3516
|
</fo:block>
|
3014
3517
|
|
3015
|
-
</xsl:when>
|
3518
|
+
</xsl:when> <!-- END: only one component -->
|
3016
3519
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
3017
3520
|
<fo:block margin-bottom="12pt" text-align="left">
|
3018
3521
|
|
@@ -3026,8 +3529,8 @@
|
|
3026
3529
|
</xsl:variable>
|
3027
3530
|
<xsl:value-of select="$title-where"/>
|
3028
3531
|
</fo:block>
|
3029
|
-
</xsl:when>
|
3030
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
3532
|
+
</xsl:when> <!-- END: a few components -->
|
3533
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
3031
3534
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
3032
3535
|
|
3033
3536
|
|
@@ -3040,11 +3543,11 @@
|
|
3040
3543
|
</xsl:variable>
|
3041
3544
|
<xsl:value-of select="$title-key"/>
|
3042
3545
|
</fo:block>
|
3043
|
-
</xsl:when>
|
3546
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
3044
3547
|
</xsl:choose>
|
3045
3548
|
|
3046
3549
|
<!-- a few components -->
|
3047
|
-
<xsl:if test="
|
3550
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
3048
3551
|
<fo:block>
|
3049
3552
|
|
3050
3553
|
|
@@ -3055,7 +3558,18 @@
|
|
3055
3558
|
|
3056
3559
|
|
3057
3560
|
|
3561
|
+
|
3562
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3563
|
+
<!-- to determine start of table -->
|
3564
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3565
|
+
</xsl:if>
|
3566
|
+
|
3058
3567
|
<fo:table width="95%" table-layout="fixed">
|
3568
|
+
|
3569
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3570
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3571
|
+
</xsl:if>
|
3572
|
+
|
3059
3573
|
|
3060
3574
|
<xsl:choose>
|
3061
3575
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -3064,54 +3578,143 @@
|
|
3064
3578
|
|
3065
3579
|
</xsl:when>
|
3066
3580
|
</xsl:choose>
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3581
|
+
|
3582
|
+
|
3583
|
+
<xsl:choose>
|
3584
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3585
|
+
<!-- generate IF for table widths -->
|
3586
|
+
<!-- example:
|
3587
|
+
<tr>
|
3588
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3589
|
+
<p>Symbol</p>
|
3590
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3591
|
+
</td>
|
3592
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3593
|
+
<p>Description</p>
|
3594
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3595
|
+
</td>
|
3596
|
+
</tr>
|
3597
|
+
-->
|
3070
3598
|
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
<xsl:
|
3075
|
-
<
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3599
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
3600
|
+
<xsl:variable name="simple-table">
|
3601
|
+
|
3602
|
+
<xsl:variable name="dl_table">
|
3603
|
+
<tbody>
|
3604
|
+
<xsl:apply-templates mode="dl_if">
|
3605
|
+
<xsl:with-param name="id" select="@id"/>
|
3606
|
+
</xsl:apply-templates>
|
3607
|
+
</tbody>
|
3608
|
+
</xsl:variable>
|
3609
|
+
|
3610
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
3611
|
+
|
3612
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
3613
|
+
<xsl:variable name="table_without_br">
|
3614
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
3615
|
+
</xsl:variable>
|
3616
|
+
|
3617
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
3618
|
+
|
3619
|
+
<!-- Step: add id to each cell -->
|
3620
|
+
<!-- add <word>...</word> for each word, image, math -->
|
3621
|
+
<xsl:variable name="simple-table-id">
|
3622
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
3623
|
+
<xsl:with-param name="id" select="@id"/>
|
3624
|
+
</xsl:apply-templates>
|
3625
|
+
</xsl:variable>
|
3626
|
+
|
3627
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
3628
|
+
|
3629
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
3630
|
+
|
3631
|
+
</xsl:variable>
|
3632
|
+
|
3633
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
3634
|
+
|
3635
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
3636
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
3637
|
+
</xsl:apply-templates>
|
3638
|
+
|
3639
|
+
</xsl:when>
|
3640
|
+
<xsl:otherwise>
|
3641
|
+
|
3642
|
+
<xsl:variable name="simple-table">
|
3643
|
+
|
3644
|
+
<xsl:variable name="dl_table">
|
3645
|
+
<tbody>
|
3646
|
+
<xsl:apply-templates mode="dl">
|
3647
|
+
<xsl:with-param name="id" select="@id"/>
|
3648
|
+
</xsl:apply-templates>
|
3649
|
+
</tbody>
|
3650
|
+
</xsl:variable>
|
3651
|
+
|
3652
|
+
<xsl:copy-of select="$dl_table"/>
|
3653
|
+
</xsl:variable>
|
3654
|
+
|
3655
|
+
<xsl:variable name="colwidths">
|
3656
|
+
<xsl:call-template name="calculate-column-widths">
|
3657
|
+
<xsl:with-param name="cols-count" select="2"/>
|
3658
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3659
|
+
</xsl:call-template>
|
3660
|
+
</xsl:variable>
|
3661
|
+
|
3662
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3663
|
+
DEBUG
|
3664
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3665
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3666
|
+
|
3667
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3668
|
+
|
3669
|
+
<xsl:variable name="maxlength_dt">
|
3670
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
3671
|
+
</xsl:variable>
|
3672
|
+
|
3673
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
3674
|
+
false
|
3675
|
+
</xsl:variable>
|
3676
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
3677
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
3678
|
+
|
3679
|
+
|
3680
|
+
<xsl:call-template name="setColumnWidth_dl">
|
3681
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3682
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
3683
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
3684
|
+
</xsl:call-template>
|
3685
|
+
|
3686
|
+
<fo:table-body>
|
3687
|
+
|
3688
|
+
<!-- DEBUG -->
|
3689
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3690
|
+
<fo:table-row>
|
3691
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
3692
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3693
|
+
</fo:table-cell>
|
3694
|
+
</fo:table-row>
|
3695
|
+
</xsl:if>
|
3696
|
+
|
3697
|
+
<xsl:apply-templates>
|
3698
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
3699
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
3700
|
+
</xsl:apply-templates>
|
3701
|
+
|
3702
|
+
</fo:table-body>
|
3703
|
+
</xsl:otherwise>
|
3704
|
+
</xsl:choose>
|
3106
3705
|
</fo:table>
|
3107
3706
|
</fo:block>
|
3108
3707
|
</fo:block>
|
3109
|
-
</xsl:if>
|
3708
|
+
</xsl:if> <!-- END: a few components -->
|
3110
3709
|
</fo:block-container>
|
3111
3710
|
</fo:block-container>
|
3112
3711
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
3113
3712
|
<xsl:param name="colwidths"/>
|
3114
3713
|
<xsl:param name="maxlength_dt"/>
|
3714
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
3715
|
+
|
3716
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
3717
|
+
|
3115
3718
|
<xsl:choose>
|
3116
3719
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
3117
3720
|
<fo:table-column column-width="50%"/>
|
@@ -3119,6 +3722,16 @@
|
|
3119
3722
|
</xsl:when>
|
3120
3723
|
<xsl:otherwise>
|
3121
3724
|
<xsl:choose>
|
3725
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
3726
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3727
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3728
|
+
</xsl:call-template>
|
3729
|
+
</xsl:when>
|
3730
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
3731
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3732
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3733
|
+
</xsl:call-template>
|
3734
|
+
</xsl:when>
|
3122
3735
|
<!-- to set width check most wide chars like `W` -->
|
3123
3736
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
3124
3737
|
<fo:table-column column-width="7%"/>
|
@@ -3149,20 +3762,31 @@
|
|
3149
3762
|
<fo:table-column column-width="60%"/>
|
3150
3763
|
</xsl:when>
|
3151
3764
|
<xsl:otherwise>
|
3152
|
-
<xsl:
|
3153
|
-
<xsl:
|
3154
|
-
|
3155
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3156
|
-
</xsl:when>
|
3157
|
-
<xsl:otherwise>
|
3158
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3159
|
-
</xsl:otherwise>
|
3160
|
-
</xsl:choose>
|
3161
|
-
</xsl:for-each>
|
3765
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3766
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3767
|
+
</xsl:call-template>
|
3162
3768
|
</xsl:otherwise>
|
3163
3769
|
</xsl:choose>
|
3164
3770
|
</xsl:otherwise>
|
3165
3771
|
</xsl:choose>
|
3772
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
3773
|
+
<xsl:param name="colwidths"/>
|
3774
|
+
|
3775
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
3776
|
+
<xsl:choose>
|
3777
|
+
<xsl:when test=". = 1 or . = 0">
|
3778
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
3779
|
+
</xsl:when>
|
3780
|
+
<xsl:otherwise>
|
3781
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
3782
|
+
<xsl:variable name="divider">
|
3783
|
+
<xsl:value-of select="@divider"/>
|
3784
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
3785
|
+
</xsl:variable>
|
3786
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
3787
|
+
</xsl:otherwise>
|
3788
|
+
</xsl:choose>
|
3789
|
+
</xsl:for-each>
|
3166
3790
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
3167
3791
|
<xsl:variable name="lengths">
|
3168
3792
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -3186,7 +3810,6 @@
|
|
3186
3810
|
<xsl:value-of select="$maxLength"/>
|
3187
3811
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
3188
3812
|
<xsl:param name="key_iso"/>
|
3189
|
-
|
3190
3813
|
<!-- <tr>
|
3191
3814
|
<td>NOTE</td>
|
3192
3815
|
<td>
|
@@ -3194,27 +3817,47 @@
|
|
3194
3817
|
</td>
|
3195
3818
|
</tr>
|
3196
3819
|
-->
|
3197
|
-
|
3820
|
+
<!-- OLD Variant -->
|
3821
|
+
<!-- <fo:table-row>
|
3198
3822
|
<fo:table-cell>
|
3199
3823
|
<fo:block margin-top="6pt">
|
3200
3824
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3201
3825
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3202
3826
|
</xsl:if>
|
3203
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
3827
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
3204
3828
|
</fo:block>
|
3205
3829
|
</fo:table-cell>
|
3206
3830
|
<fo:table-cell>
|
3207
3831
|
<fo:block>
|
3208
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
3832
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
3833
|
+
</fo:block>
|
3834
|
+
</fo:table-cell>
|
3835
|
+
</fo:table-row> -->
|
3836
|
+
<!-- <tr>
|
3837
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
3838
|
+
</tr>
|
3839
|
+
-->
|
3840
|
+
<fo:table-row>
|
3841
|
+
<fo:table-cell number-columns-spanned="2">
|
3842
|
+
<fo:block>
|
3843
|
+
<xsl:call-template name="note"/>
|
3209
3844
|
</fo:block>
|
3210
3845
|
</fo:table-cell>
|
3211
3846
|
</fo:table-row>
|
3212
3847
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
3848
|
+
<xsl:param name="id"/>
|
3849
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3213
3850
|
<tr>
|
3214
3851
|
<td>
|
3852
|
+
<xsl:attribute name="id">
|
3853
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
3854
|
+
</xsl:attribute>
|
3215
3855
|
<xsl:apply-templates/>
|
3216
3856
|
</td>
|
3217
3857
|
<td>
|
3858
|
+
<xsl:attribute name="id">
|
3859
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
3860
|
+
</xsl:attribute>
|
3218
3861
|
|
3219
3862
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
3220
3863
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -3225,50 +3868,122 @@
|
|
3225
3868
|
|
3226
3869
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
3227
3870
|
<xsl:param name="key_iso"/>
|
3871
|
+
<xsl:param name="split_keep-within-line"/>
|
3228
3872
|
|
3229
3873
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
3230
|
-
<
|
3874
|
+
<xsl:call-template name="insert_dt_cell">
|
3875
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
3876
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3877
|
+
</xsl:call-template>
|
3878
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
3879
|
+
<xsl:call-template name="insert_dd_cell">
|
3880
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3881
|
+
</xsl:call-template>
|
3882
|
+
</xsl:for-each>
|
3883
|
+
</fo:table-row>
|
3884
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
3885
|
+
<xsl:param name="key_iso"/>
|
3886
|
+
<xsl:param name="split_keep-within-line"/>
|
3887
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
3888
|
+
|
3889
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3890
|
+
<!-- border is mandatory, to calculate real width -->
|
3891
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
3892
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3893
|
+
</xsl:if>
|
3894
|
+
|
3895
|
+
|
3896
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
3897
|
+
<xsl:copy-of select="@id"/>
|
3898
|
+
|
3899
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3900
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3901
|
+
</xsl:if>
|
3902
|
+
|
3903
|
+
|
3904
|
+
|
3905
|
+
<xsl:apply-templates>
|
3906
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3907
|
+
</xsl:apply-templates>
|
3908
|
+
|
3909
|
+
<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"/> -->
|
3910
|
+
|
3911
|
+
</fo:block>
|
3912
|
+
</fo:table-cell>
|
3913
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
3914
|
+
<xsl:param name="split_keep-within-line"/>
|
3915
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
3916
|
+
|
3917
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3918
|
+
<!-- border is mandatory, to calculate real width -->
|
3919
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
3920
|
+
</xsl:if>
|
3921
|
+
|
3922
|
+
<fo:block>
|
3923
|
+
|
3924
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3925
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3926
|
+
</xsl:if>
|
3927
|
+
|
3231
3928
|
|
3232
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
3233
|
-
<xsl:copy-of select="@id"/>
|
3234
|
-
|
3235
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3236
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3237
|
-
</xsl:if>
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
<xsl:apply-templates/>
|
3242
|
-
</fo:block>
|
3243
|
-
</fo:table-cell>
|
3244
|
-
<fo:table-cell>
|
3245
|
-
<fo:block>
|
3246
|
-
|
3247
3929
|
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3930
|
+
<xsl:choose>
|
3931
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3932
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
3933
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
3934
|
+
</xsl:apply-templates>
|
3935
|
+
</xsl:when>
|
3936
|
+
<xsl:otherwise>
|
3937
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
3938
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
3939
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3940
|
+
</xsl:apply-templates>
|
3941
|
+
</xsl:otherwise>
|
3942
|
+
|
3943
|
+
</xsl:choose>
|
3944
|
+
|
3945
|
+
<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"/> -->
|
3946
|
+
|
3947
|
+
</fo:block>
|
3948
|
+
</fo:table-cell>
|
3254
3949
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
3255
3950
|
<xsl:apply-templates/>
|
3256
3951
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
3257
3952
|
<xsl:param name="process">false</xsl:param>
|
3953
|
+
<xsl:param name="split_keep-within-line"/>
|
3258
3954
|
<xsl:if test="$process = 'true'">
|
3259
3955
|
<xsl:apply-templates select="@language"/>
|
3260
|
-
<xsl:apply-templates
|
3956
|
+
<xsl:apply-templates>
|
3957
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3958
|
+
</xsl:apply-templates>
|
3261
3959
|
</xsl:if>
|
3262
3960
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
3263
3961
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
3264
|
-
</xsl:template><xsl:template match="*[local-name()='
|
3962
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
3963
|
+
<xsl:param name="id"/>
|
3964
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3965
|
+
<tr>
|
3966
|
+
<td>
|
3967
|
+
<xsl:copy-of select="node()"/>
|
3968
|
+
</td>
|
3969
|
+
<td>
|
3970
|
+
|
3971
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
3972
|
+
|
3973
|
+
</td>
|
3974
|
+
</tr>
|
3975
|
+
|
3976
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
3265
3977
|
<fo:inline font-style="italic">
|
3266
3978
|
<xsl:apply-templates/>
|
3267
3979
|
</fo:inline>
|
3268
3980
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
3981
|
+
<xsl:param name="split_keep-within-line"/>
|
3269
3982
|
<fo:inline font-weight="bold">
|
3270
3983
|
|
3271
|
-
<xsl:apply-templates
|
3984
|
+
<xsl:apply-templates>
|
3985
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3986
|
+
</xsl:apply-templates>
|
3272
3987
|
</fo:inline>
|
3273
3988
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
3274
3989
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -3307,13 +4022,15 @@
|
|
3307
4022
|
<xsl:choose>
|
3308
4023
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
3309
4024
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
3310
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4025
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
3311
4026
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
3312
4027
|
</xsl:choose>
|
3313
4028
|
</xsl:attribute>
|
3314
4029
|
</xsl:if>
|
3315
4030
|
<xsl:apply-templates/>
|
3316
4031
|
</fo:inline>
|
4032
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4033
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
3317
4034
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3318
4035
|
<fo:inline text-decoration="underline">
|
3319
4036
|
<xsl:apply-templates/>
|
@@ -3461,54 +4178,120 @@
|
|
3461
4178
|
<fo:block break-after="page"/>
|
3462
4179
|
<fo:block> </fo:block>
|
3463
4180
|
<fo:block break-after="page"/>
|
4181
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
4182
|
+
<xsl:apply-templates/>
|
3464
4183
|
</xsl:template><xsl:template name="tokenize">
|
3465
4184
|
<xsl:param name="text"/>
|
3466
4185
|
<xsl:param name="separator" select="' '"/>
|
3467
4186
|
<xsl:choose>
|
4187
|
+
|
4188
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
4189
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
4190
|
+
</xsl:when>
|
3468
4191
|
<xsl:when test="not(contains($text, $separator))">
|
3469
4192
|
<word>
|
3470
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
3471
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
3472
4193
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
3473
|
-
<xsl:variable name="len_str">
|
3474
|
-
<xsl:choose>
|
3475
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
3476
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
3477
|
-
</xsl:when>
|
3478
|
-
<xsl:otherwise>
|
3479
|
-
<xsl:value-of select="$len_str_tmp"/>
|
3480
|
-
</xsl:otherwise>
|
3481
|
-
</xsl:choose>
|
3482
|
-
</xsl:variable>
|
3483
|
-
|
3484
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
3485
|
-
<xsl:message>
|
3486
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
3487
|
-
len_str=<xsl:value-of select="$len_str"/>
|
3488
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
3489
|
-
</xsl:message>
|
3490
|
-
</xsl:if> -->
|
3491
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
3492
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
3493
4194
|
<xsl:choose>
|
3494
|
-
<xsl:when test="$
|
3495
|
-
<xsl:value-of select="$
|
4195
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
4196
|
+
<xsl:value-of select="$len_str_tmp"/>
|
3496
4197
|
</xsl:when>
|
3497
4198
|
<xsl:otherwise>
|
3498
|
-
<xsl:
|
4199
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4200
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4201
|
+
<xsl:variable name="len_str">
|
4202
|
+
<xsl:choose>
|
4203
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4204
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4205
|
+
</xsl:when>
|
4206
|
+
<xsl:otherwise>
|
4207
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4208
|
+
</xsl:otherwise>
|
4209
|
+
</xsl:choose>
|
4210
|
+
</xsl:variable>
|
4211
|
+
|
4212
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4213
|
+
<xsl:message>
|
4214
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4215
|
+
len_str=<xsl:value-of select="$len_str"/>
|
4216
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4217
|
+
</xsl:message>
|
4218
|
+
</xsl:if> -->
|
4219
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4220
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4221
|
+
<xsl:choose>
|
4222
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
4223
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
4224
|
+
</xsl:when>
|
4225
|
+
<xsl:otherwise>
|
4226
|
+
<xsl:value-of select="$len_str"/>
|
4227
|
+
</xsl:otherwise>
|
4228
|
+
</xsl:choose>
|
3499
4229
|
</xsl:otherwise>
|
3500
4230
|
</xsl:choose>
|
3501
4231
|
</word>
|
3502
4232
|
</xsl:when>
|
3503
4233
|
<xsl:otherwise>
|
3504
4234
|
<word>
|
3505
|
-
<xsl:
|
4235
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
4236
|
+
<xsl:choose>
|
4237
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4238
|
+
<xsl:value-of select="$word"/>
|
4239
|
+
</xsl:when>
|
4240
|
+
<xsl:otherwise>
|
4241
|
+
<xsl:value-of select="string-length($word)"/>
|
4242
|
+
</xsl:otherwise>
|
4243
|
+
</xsl:choose>
|
3506
4244
|
</word>
|
3507
4245
|
<xsl:call-template name="tokenize">
|
3508
4246
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
3509
4247
|
</xsl:call-template>
|
3510
4248
|
</xsl:otherwise>
|
3511
4249
|
</xsl:choose>
|
4250
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
4251
|
+
<xsl:param name="tags"/>
|
4252
|
+
<xsl:param name="text"/>
|
4253
|
+
<xsl:param name="separator" select="' '"/>
|
4254
|
+
<xsl:choose>
|
4255
|
+
|
4256
|
+
<xsl:when test="not(contains($text, $separator))">
|
4257
|
+
<word>
|
4258
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4259
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
4260
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4261
|
+
</xsl:call-template>
|
4262
|
+
</word>
|
4263
|
+
</xsl:when>
|
4264
|
+
<xsl:otherwise>
|
4265
|
+
<word>
|
4266
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4267
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
4268
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4269
|
+
</xsl:call-template>
|
4270
|
+
</word>
|
4271
|
+
<xsl:call-template name="tokenize_with_tags">
|
4272
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
4273
|
+
</xsl:call-template>
|
4274
|
+
</xsl:otherwise>
|
4275
|
+
</xsl:choose>
|
4276
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
4277
|
+
<xsl:param name="text"/>
|
4278
|
+
<xsl:param name="tags"/>
|
4279
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
4280
|
+
|
4281
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
4282
|
+
|
4283
|
+
<xsl:choose>
|
4284
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
4285
|
+
<xsl:otherwise>
|
4286
|
+
<xsl:element name="{$tag_name}">
|
4287
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4288
|
+
<xsl:with-param name="text" select="$text"/>
|
4289
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4290
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
4291
|
+
</xsl:call-template>
|
4292
|
+
</xsl:element>
|
4293
|
+
</xsl:otherwise>
|
4294
|
+
</xsl:choose>
|
3512
4295
|
</xsl:template><xsl:template name="max_length">
|
3513
4296
|
<xsl:param name="words"/>
|
3514
4297
|
<xsl:for-each select="$words//word">
|
@@ -3581,36 +4364,47 @@
|
|
3581
4364
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
3582
4365
|
<xsl:param name="text" select="."/>
|
3583
4366
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
4367
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
3584
4368
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
4369
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
3585
4370
|
<xsl:variable name="zero-space"></xsl:variable>
|
3586
4371
|
<xsl:choose>
|
3587
4372
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
3588
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
4373
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
3589
4374
|
<xsl:value-of select="$zero-space-after-equals"/>
|
3590
4375
|
<xsl:value-of select="$zero-space"/>
|
3591
4376
|
<xsl:call-template name="add-zero-spaces-equal">
|
3592
4377
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
3593
|
-
</xsl:call-template>
|
4378
|
+
</xsl:call-template> -->
|
4379
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
3594
4380
|
</xsl:when>
|
3595
4381
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
3596
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
4382
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
3597
4383
|
<xsl:value-of select="$zero-space-after-equal"/>
|
3598
4384
|
<xsl:value-of select="$zero-space"/>
|
3599
4385
|
<xsl:call-template name="add-zero-spaces-equal">
|
3600
4386
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
3601
|
-
</xsl:call-template>
|
4387
|
+
</xsl:call-template> -->
|
4388
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
3602
4389
|
</xsl:when>
|
3603
4390
|
<xsl:otherwise>
|
3604
4391
|
<xsl:value-of select="$text"/>
|
3605
4392
|
</xsl:otherwise>
|
3606
4393
|
</xsl:choose>
|
3607
4394
|
</xsl:template><xsl:template name="getSimpleTable">
|
4395
|
+
<xsl:param name="id"/>
|
4396
|
+
|
3608
4397
|
<xsl:variable name="simple-table">
|
3609
4398
|
|
4399
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
4400
|
+
<xsl:variable name="table_without_br">
|
4401
|
+
<xsl:apply-templates mode="table-without-br"/>
|
4402
|
+
</xsl:variable>
|
4403
|
+
|
3610
4404
|
<!-- Step 1. colspan processing -->
|
3611
4405
|
<xsl:variable name="simple-table-colspan">
|
3612
4406
|
<tbody>
|
3613
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
4407
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
3614
4408
|
</tbody>
|
3615
4409
|
</xsl:variable>
|
3616
4410
|
|
@@ -3619,10 +4413,67 @@
|
|
3619
4413
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
3620
4414
|
</xsl:variable>
|
3621
4415
|
|
3622
|
-
|
3623
|
-
|
4416
|
+
<!-- Step 3: add id to each cell -->
|
4417
|
+
<!-- add <word>...</word> for each word, image, math -->
|
4418
|
+
<xsl:variable name="simple-table-id">
|
4419
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
4420
|
+
<xsl:with-param name="id" select="$id"/>
|
4421
|
+
</xsl:apply-templates>
|
4422
|
+
</xsl:variable>
|
4423
|
+
|
4424
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
4425
|
+
|
3624
4426
|
</xsl:variable>
|
3625
4427
|
<xsl:copy-of select="$simple-table"/>
|
4428
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
4429
|
+
<xsl:copy>
|
4430
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
4431
|
+
</xsl:copy>
|
4432
|
+
</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">
|
4433
|
+
<xsl:copy>
|
4434
|
+
<xsl:copy-of select="@*"/>
|
4435
|
+
<p>
|
4436
|
+
<xsl:copy-of select="node()"/>
|
4437
|
+
</p>
|
4438
|
+
</xsl:copy>
|
4439
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
4440
|
+
<xsl:copy>
|
4441
|
+
<xsl:copy-of select="@*"/>
|
4442
|
+
<xsl:for-each select="*[local-name()='br']">
|
4443
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4444
|
+
<p>
|
4445
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4446
|
+
<xsl:copy-of select="."/>
|
4447
|
+
</xsl:for-each>
|
4448
|
+
</p>
|
4449
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4450
|
+
<p>
|
4451
|
+
<xsl:for-each select="following-sibling::node()">
|
4452
|
+
<xsl:copy-of select="."/>
|
4453
|
+
</xsl:for-each>
|
4454
|
+
</p>
|
4455
|
+
</xsl:if>
|
4456
|
+
</xsl:for-each>
|
4457
|
+
</xsl:copy>
|
4458
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
4459
|
+
<xsl:for-each select="*[local-name()='br']">
|
4460
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4461
|
+
<p>
|
4462
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4463
|
+
<xsl:copy-of select="."/>
|
4464
|
+
</xsl:for-each>
|
4465
|
+
</p>
|
4466
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4467
|
+
<p>
|
4468
|
+
<xsl:for-each select="following-sibling::node()">
|
4469
|
+
<xsl:copy-of select="."/>
|
4470
|
+
</xsl:for-each>
|
4471
|
+
</p>
|
4472
|
+
</xsl:if>
|
4473
|
+
</xsl:for-each>
|
4474
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
4475
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
4476
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
3626
4477
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
3627
4478
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
3628
4479
|
</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">
|
@@ -3712,6 +4563,126 @@
|
|
3712
4563
|
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
3713
4564
|
<xsl:with-param name="previousRow" select="$newRow"/>
|
3714
4565
|
</xsl:apply-templates>
|
4566
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
4567
|
+
<xsl:param name="id"/>
|
4568
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
4569
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4570
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
4571
|
+
</xsl:apply-templates>
|
4572
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
4573
|
+
<xsl:param name="id"/>
|
4574
|
+
<xsl:copy>
|
4575
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4576
|
+
<xsl:with-param name="id" select="$id"/>
|
4577
|
+
</xsl:apply-templates>
|
4578
|
+
</xsl:copy>
|
4579
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
4580
|
+
<xsl:param name="id"/>
|
4581
|
+
<xsl:copy>
|
4582
|
+
<xsl:copy-of select="@*"/>
|
4583
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
4584
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
4585
|
+
<xsl:with-param name="id" select="$id"/>
|
4586
|
+
</xsl:apply-templates>
|
4587
|
+
</xsl:copy>
|
4588
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
4589
|
+
<xsl:param name="id"/>
|
4590
|
+
<xsl:copy>
|
4591
|
+
<xsl:copy-of select="@*"/>
|
4592
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
4593
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
4594
|
+
<xsl:attribute name="id">
|
4595
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
4596
|
+
</xsl:attribute>
|
4597
|
+
|
4598
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
4599
|
+
<xsl:copy>
|
4600
|
+
<xsl:copy-of select="@*"/>
|
4601
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
4602
|
+
<xsl:attribute name="id">
|
4603
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
4604
|
+
</xsl:attribute>
|
4605
|
+
|
4606
|
+
<xsl:copy-of select="node()"/>
|
4607
|
+
</xsl:copy>
|
4608
|
+
</xsl:for-each>
|
4609
|
+
|
4610
|
+
|
4611
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
4612
|
+
|
4613
|
+
<xsl:variable name="td_text">
|
4614
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
4615
|
+
</xsl:variable>
|
4616
|
+
|
4617
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
4618
|
+
|
4619
|
+
<xsl:variable name="words">
|
4620
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
4621
|
+
<word>
|
4622
|
+
<xsl:copy-of select="."/>
|
4623
|
+
</word>
|
4624
|
+
</xsl:for-each>
|
4625
|
+
|
4626
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
4627
|
+
<xsl:copy-of select="."/>
|
4628
|
+
</xsl:for-each>
|
4629
|
+
|
4630
|
+
</xsl:variable>
|
4631
|
+
|
4632
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
4633
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
4634
|
+
<xsl:copy>
|
4635
|
+
<xsl:attribute name="id">
|
4636
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
4637
|
+
</xsl:attribute>
|
4638
|
+
<xsl:copy-of select="node()"/>
|
4639
|
+
</xsl:copy>
|
4640
|
+
</xsl:for-each>
|
4641
|
+
</xsl:if>
|
4642
|
+
</xsl:copy>
|
4643
|
+
|
4644
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
4645
|
+
<xsl:copy>
|
4646
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
4647
|
+
</xsl:copy>
|
4648
|
+
</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">
|
4649
|
+
<xsl:variable name="formatting_tags">
|
4650
|
+
<xsl:call-template name="getFormattingTags"/>
|
4651
|
+
</xsl:variable>
|
4652
|
+
<word>
|
4653
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4654
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
4655
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4656
|
+
</xsl:call-template>
|
4657
|
+
</word>
|
4658
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
4659
|
+
|
4660
|
+
<xsl:variable name="td_text" select="."/>
|
4661
|
+
|
4662
|
+
<xsl:variable name="string_with_added_zerospaces">
|
4663
|
+
<xsl:call-template name="add-zero-spaces-java">
|
4664
|
+
<xsl:with-param name="text" select="$td_text"/>
|
4665
|
+
</xsl:call-template>
|
4666
|
+
</xsl:variable>
|
4667
|
+
|
4668
|
+
<xsl:variable name="formatting_tags">
|
4669
|
+
<xsl:call-template name="getFormattingTags"/>
|
4670
|
+
</xsl:variable>
|
4671
|
+
|
4672
|
+
<!-- <word>text</word> -->
|
4673
|
+
<xsl:call-template name="tokenize_with_tags">
|
4674
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4675
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
4676
|
+
</xsl:call-template>
|
4677
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
4678
|
+
<tags>
|
4679
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
4680
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
4681
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
4682
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
4683
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
4684
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
4685
|
+
</tags>
|
3715
4686
|
</xsl:template><xsl:template name="getLang">
|
3716
4687
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
3717
4688
|
<xsl:variable name="language">
|
@@ -3766,6 +4737,9 @@
|
|
3766
4737
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
3767
4738
|
|
3768
4739
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
4740
|
+
|
4741
|
+
|
4742
|
+
|
3769
4743
|
|
3770
4744
|
|
3771
4745
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -3773,48 +4747,80 @@
|
|
3773
4747
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
3774
4748
|
</xsl:call-template>
|
3775
4749
|
|
4750
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
4751
|
+
<!-- insert helper tag -->
|
4752
|
+
<!-- set unique font-size (fiction) -->
|
4753
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
4754
|
+
<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 -->
|
4755
|
+
</xsl:if>
|
3776
4756
|
|
3777
|
-
|
3778
|
-
|
3779
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
4757
|
+
<xsl:variable name="mathml_content">
|
4758
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
3780
4759
|
</xsl:variable>
|
3781
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
3782
4760
|
|
4761
|
+
|
4762
|
+
<xsl:call-template name="mathml_instream_object">
|
4763
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
4764
|
+
</xsl:call-template>
|
3783
4765
|
|
3784
|
-
|
3785
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
3786
|
-
<xsl:variable name="comment_text_">
|
3787
|
-
<xsl:choose>
|
3788
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
3789
|
-
<xsl:value-of select="$comment_text_following"/>
|
3790
|
-
</xsl:when>
|
3791
|
-
<xsl:otherwise>
|
3792
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
3793
|
-
</xsl:otherwise>
|
3794
|
-
</xsl:choose>
|
3795
|
-
</xsl:variable>
|
3796
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
3797
|
-
|
3798
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
3799
|
-
<!-- put Mathin Alternate Text -->
|
3800
|
-
<xsl:attribute name="fox:alt-text">
|
3801
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
3802
|
-
</xsl:attribute>
|
3803
|
-
</xsl:if>
|
3804
|
-
|
3805
|
-
<xsl:variable name="mathml_content">
|
3806
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
3807
|
-
</xsl:variable>
|
3808
|
-
<!-- put MathML in Actual Text -->
|
3809
|
-
<xsl:attribute name="fox:actual-text">
|
3810
|
-
<xsl:value-of select="$mathml_content"/>
|
3811
|
-
</xsl:attribute>
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
3816
|
-
</fo:instream-foreign-object>
|
4766
|
+
|
3817
4767
|
</fo:inline>
|
4768
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
4769
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
4770
|
+
<xsl:variable name="comment_text_">
|
4771
|
+
<xsl:choose>
|
4772
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
4773
|
+
<xsl:value-of select="$comment_text_following"/>
|
4774
|
+
</xsl:when>
|
4775
|
+
<xsl:otherwise>
|
4776
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
4777
|
+
</xsl:otherwise>
|
4778
|
+
</xsl:choose>
|
4779
|
+
</xsl:variable>
|
4780
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
4781
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
4782
|
+
<xsl:value-of select="$comment_text"/>
|
4783
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
4784
|
+
<xsl:param name="comment_text"/>
|
4785
|
+
<xsl:param name="mathml_content"/>
|
4786
|
+
|
4787
|
+
<xsl:variable name="comment_text_">
|
4788
|
+
<xsl:choose>
|
4789
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
4790
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
4791
|
+
</xsl:choose>
|
4792
|
+
</xsl:variable>
|
4793
|
+
|
4794
|
+
<xsl:variable name="mathml">
|
4795
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
4796
|
+
</xsl:variable>
|
4797
|
+
|
4798
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
4799
|
+
|
4800
|
+
|
4801
|
+
|
4802
|
+
|
4803
|
+
|
4804
|
+
|
4805
|
+
|
4806
|
+
<!-- put MathML in Actual Text -->
|
4807
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
4808
|
+
<xsl:attribute name="fox:actual-text">
|
4809
|
+
<xsl:value-of select="$mathml_content"/>
|
4810
|
+
</xsl:attribute>
|
4811
|
+
|
4812
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
4813
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
4814
|
+
<!-- put Mathin Alternate Text -->
|
4815
|
+
<xsl:attribute name="fox:alt-text">
|
4816
|
+
<xsl:value-of select="$comment_text_"/>
|
4817
|
+
</xsl:attribute>
|
4818
|
+
</xsl:if>
|
4819
|
+
<!-- </xsl:if> -->
|
4820
|
+
|
4821
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
4822
|
+
|
4823
|
+
</fo:instream-foreign-object>
|
3818
4824
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
3819
4825
|
<!-- <xsl:text>a+b</xsl:text> -->
|
3820
4826
|
<xsl:text><</xsl:text>
|
@@ -3845,7 +4851,9 @@
|
|
3845
4851
|
<!-- replace start and end spaces to non-break space -->
|
3846
4852
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
3847
4853
|
</xsl:copy>
|
3848
|
-
</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="
|
4854
|
+
</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">
|
4855
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
4856
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
3849
4857
|
<xsl:variable name="target">
|
3850
4858
|
<xsl:choose>
|
3851
4859
|
<xsl:when test="@updatetype = 'true'">
|
@@ -4074,7 +5082,12 @@
|
|
4074
5082
|
|
4075
5083
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
4076
5084
|
|
5085
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
5086
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
5087
|
+
</xsl:if>
|
5088
|
+
|
4077
5089
|
|
5090
|
+
|
4078
5091
|
|
4079
5092
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
4080
5093
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -4431,18 +5444,33 @@
|
|
4431
5444
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
4432
5445
|
<xsl:copy>
|
4433
5446
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
4434
|
-
<xsl:variable name="
|
5447
|
+
<xsl:variable name="viewbox_">
|
4435
5448
|
<xsl:call-template name="split">
|
4436
5449
|
<xsl:with-param name="pText" select="@viewBox"/>
|
4437
5450
|
<xsl:with-param name="sep" select="' '"/>
|
4438
5451
|
</xsl:call-template>
|
4439
5452
|
</xsl:variable>
|
5453
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
5454
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
5455
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
5456
|
+
|
4440
5457
|
<xsl:attribute name="width">
|
4441
|
-
<xsl:
|
5458
|
+
<xsl:choose>
|
5459
|
+
<xsl:when test="$width != ''">
|
5460
|
+
<xsl:value-of select="round($width)"/>
|
5461
|
+
</xsl:when>
|
5462
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
5463
|
+
</xsl:choose>
|
4442
5464
|
</xsl:attribute>
|
4443
5465
|
<xsl:attribute name="height">
|
4444
|
-
<xsl:
|
5466
|
+
<xsl:choose>
|
5467
|
+
<xsl:when test="$height != ''">
|
5468
|
+
<xsl:value-of select="round($height)"/>
|
5469
|
+
</xsl:when>
|
5470
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
5471
|
+
</xsl:choose>
|
4445
5472
|
</xsl:attribute>
|
5473
|
+
|
4446
5474
|
<xsl:apply-templates mode="svg_update"/>
|
4447
5475
|
</xsl:copy>
|
4448
5476
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -4637,7 +5665,11 @@
|
|
4637
5665
|
<xsl:apply-templates mode="bookmarks"/>
|
4638
5666
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
4639
5667
|
<xsl:apply-templates select="."/>
|
4640
|
-
</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() = '
|
5668
|
+
</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">
|
5669
|
+
<xsl:apply-templates mode="contents"/>
|
5670
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
5671
|
+
<xsl:apply-templates mode="bookmarks"/>
|
5672
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
4641
5673
|
<xsl:apply-templates mode="bookmarks"/>
|
4642
5674
|
</xsl:template><xsl:template name="addBookmarks">
|
4643
5675
|
<xsl:param name="contents"/>
|
@@ -4919,7 +5951,9 @@
|
|
4919
5951
|
<xsl:apply-templates/>
|
4920
5952
|
</xsl:otherwise>
|
4921
5953
|
</xsl:choose>
|
4922
|
-
</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() = '
|
5954
|
+
</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">
|
5955
|
+
<xsl:value-of select="."/>
|
5956
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
4923
5957
|
<xsl:text> </xsl:text>
|
4924
5958
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
4925
5959
|
<xsl:copy>
|
@@ -4950,9 +5984,22 @@
|
|
4950
5984
|
</xsl:when>
|
4951
5985
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
4952
5986
|
</xsl:choose>
|
5987
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
5988
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
5989
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
5990
|
+
<xsl:apply-templates mode="contents_item"/>
|
4953
5991
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
4954
5992
|
|
4955
5993
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
5994
|
+
|
5995
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
5996
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
5997
|
+
</xsl:if>
|
5998
|
+
|
5999
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6000
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6001
|
+
</xsl:if>
|
6002
|
+
|
4956
6003
|
<xsl:copy-of select="@id"/>
|
4957
6004
|
|
4958
6005
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -5052,17 +6099,15 @@
|
|
5052
6099
|
|
5053
6100
|
<!-- split text by zero-width space -->
|
5054
6101
|
<xsl:variable name="text_step4">
|
5055
|
-
<xsl:call-template name="
|
6102
|
+
<xsl:call-template name="split_for_interspers">
|
5056
6103
|
<xsl:with-param name="pText" select="$text_step3"/>
|
5057
6104
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
5058
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
5059
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
5060
6105
|
</xsl:call-template>
|
5061
6106
|
</xsl:variable>
|
5062
6107
|
|
5063
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
6108
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
5064
6109
|
<xsl:choose>
|
5065
|
-
<xsl:when test="
|
6110
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
5066
6111
|
<xsl:call-template name="interspers">
|
5067
6112
|
<xsl:with-param name="str" select="."/>
|
5068
6113
|
</xsl:call-template>
|
@@ -5073,6 +6118,30 @@
|
|
5073
6118
|
</xsl:choose>
|
5074
6119
|
</xsl:for-each>
|
5075
6120
|
|
6121
|
+
</xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
|
6122
|
+
<xsl:param name="pText" select="."/>
|
6123
|
+
<xsl:param name="sep" select="','"/>
|
6124
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
6125
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
6126
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
6127
|
+
<xsl:call-template name="replace_tag_interspers">
|
6128
|
+
<xsl:with-param name="text" select="$text"/>
|
6129
|
+
</xsl:call-template>
|
6130
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
6131
|
+
<xsl:param name="text"/>
|
6132
|
+
<xsl:choose>
|
6133
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
6134
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
6135
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
6136
|
+
<interspers>
|
6137
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
6138
|
+
</interspers>
|
6139
|
+
<xsl:call-template name="replace_tag_interspers">
|
6140
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
6141
|
+
</xsl:call-template>
|
6142
|
+
</xsl:when>
|
6143
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
6144
|
+
</xsl:choose>
|
5076
6145
|
</xsl:template><xsl:template name="interspers">
|
5077
6146
|
<xsl:param name="str"/>
|
5078
6147
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -5301,7 +6370,9 @@
|
|
5301
6370
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
5302
6371
|
</xsl:if>
|
5303
6372
|
<xsl:variable name="simple-table">
|
5304
|
-
<xsl:call-template name="getSimpleTable"
|
6373
|
+
<xsl:call-template name="getSimpleTable">
|
6374
|
+
<xsl:with-param name="id" select="@id"/>
|
6375
|
+
</xsl:call-template>
|
5305
6376
|
</xsl:variable>
|
5306
6377
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
5307
6378
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -5408,39 +6479,67 @@
|
|
5408
6479
|
</xsl:otherwise>
|
5409
6480
|
</xsl:choose>
|
5410
6481
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
5411
|
-
|
5412
|
-
|
6482
|
+
|
6483
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
6484
|
+
|
5413
6485
|
|
6486
|
+
|
5414
6487
|
<xsl:variable name="fo_element">
|
5415
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
6488
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
5416
6489
|
block
|
5417
6490
|
</xsl:variable>
|
5418
6491
|
|
5419
|
-
|
5420
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
5421
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5422
|
-
</xsl:apply-templates>
|
6492
|
+
<fo:block-container margin-left="0mm">
|
5423
6493
|
|
5424
|
-
|
5425
|
-
|
5426
|
-
<
|
5427
|
-
|
5428
|
-
|
6494
|
+
<xsl:choose>
|
6495
|
+
|
6496
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
6497
|
+
|
6498
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
6499
|
+
<fo:block>
|
6500
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
5429
6501
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5430
6502
|
</xsl:apply-templates>
|
6503
|
+
</fo:block>
|
6504
|
+
|
6505
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6506
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6507
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
6508
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6509
|
+
</xsl:apply-templates>
|
6510
|
+
</fo:block-container>
|
5431
6511
|
</fo:block-container>
|
5432
|
-
</
|
5433
|
-
|
5434
|
-
|
5435
|
-
|
5436
|
-
|
5437
|
-
|
5438
|
-
|
5439
|
-
|
5440
|
-
|
5441
|
-
|
5442
|
-
|
5443
|
-
|
6512
|
+
</xsl:when> <!-- end block -->
|
6513
|
+
|
6514
|
+
<xsl:otherwise> <!-- inline -->
|
6515
|
+
|
6516
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
6517
|
+
<fo:block>
|
6518
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6519
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6520
|
+
</xsl:apply-templates>
|
6521
|
+
<fo:inline>
|
6522
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
6523
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6524
|
+
</xsl:apply-templates>
|
6525
|
+
</fo:inline>
|
6526
|
+
</fo:block>
|
6527
|
+
|
6528
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
6529
|
+
<!-- display further elements in blocks -->
|
6530
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6531
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6532
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
6533
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
6534
|
+
</xsl:apply-templates>
|
6535
|
+
</fo:block-container>
|
6536
|
+
</fo:block-container>
|
6537
|
+
</xsl:if>
|
6538
|
+
</xsl:otherwise> <!-- end inline -->
|
6539
|
+
|
6540
|
+
</xsl:choose>
|
6541
|
+
</fo:block-container>
|
6542
|
+
</fo:block-container>
|
5444
6543
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
5445
6544
|
<xsl:param name="fo_element">block</xsl:param>
|
5446
6545
|
|
@@ -5472,10 +6571,16 @@
|
|
5472
6571
|
</xsl:variable>
|
5473
6572
|
<xsl:choose>
|
5474
6573
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
5475
|
-
<fo:block
|
5476
|
-
|
5477
|
-
|
5478
|
-
|
6574
|
+
<fo:block-container>
|
6575
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
6576
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6577
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6578
|
+
</xsl:if>
|
6579
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
6580
|
+
|
6581
|
+
<xsl:apply-templates/>
|
6582
|
+
</fo:block>
|
6583
|
+
</fo:block-container>
|
5479
6584
|
</xsl:when>
|
5480
6585
|
<xsl:otherwise>
|
5481
6586
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -5520,7 +6625,7 @@
|
|
5520
6625
|
</xsl:otherwise>
|
5521
6626
|
</xsl:choose> -->
|
5522
6627
|
</fo:block>
|
5523
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
6628
|
+
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
|
5524
6629
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
5525
6630
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
5526
6631
|
<xsl:if test="normalize-space() != ''">
|
@@ -5657,7 +6762,16 @@
|
|
5657
6762
|
</fo:inline>
|
5658
6763
|
</xsl:when>
|
5659
6764
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
5660
|
-
|
6765
|
+
|
6766
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
6767
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
6768
|
+
<xsl:choose>
|
6769
|
+
<xsl:when test="$uri_src != ''">
|
6770
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
6771
|
+
</xsl:when>
|
6772
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
6773
|
+
</xsl:choose>
|
6774
|
+
|
5661
6775
|
</xsl:otherwise>
|
5662
6776
|
</xsl:choose>
|
5663
6777
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -5839,10 +6953,24 @@
|
|
5839
6953
|
|
5840
6954
|
</fo:block>
|
5841
6955
|
<xsl:apply-templates/>
|
5842
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
6956
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
5843
6957
|
<!-- comment 2019-11-29 -->
|
5844
6958
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
5845
6959
|
<xsl:apply-templates /> -->
|
6960
|
+
|
6961
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
6962
|
+
|
6963
|
+
<xsl:choose>
|
6964
|
+
<!-- if there isn't the attribute '@from', then -->
|
6965
|
+
<xsl:when test="$id_from = ''">
|
6966
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
6967
|
+
</xsl:when>
|
6968
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
6969
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
6970
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
6971
|
+
</xsl:when>
|
6972
|
+
</xsl:choose>
|
6973
|
+
|
5846
6974
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
5847
6975
|
<!-- 0xA0 to space replacement -->
|
5848
6976
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -6203,7 +7331,10 @@
|
|
6203
7331
|
<!-- to split by '_' and other chars -->
|
6204
7332
|
<xsl:call-template name="add-zero-spaces-java"/>
|
6205
7333
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
6206
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7334
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7335
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7336
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7337
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
6207
7338
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
6208
7339
|
<!-- <row>
|
6209
7340
|
<date>05-07-2013</date>
|
@@ -6749,6 +7880,120 @@
|
|
6749
7880
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
6750
7881
|
</xsl:for-each>
|
6751
7882
|
</xsl:copy>
|
7883
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
7884
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
7885
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
7886
|
+
<xsl:copy>
|
7887
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
7888
|
+
</xsl:copy>
|
7889
|
+
</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">
|
7890
|
+
|
7891
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
7892
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
7893
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
7894
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
7895
|
+
<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))"/>
|
7896
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
7897
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
7898
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
7899
|
+
<xsl:with-param name="text" select="$text_"/>
|
7900
|
+
</xsl:call-template></text></xsl:variable>
|
7901
|
+
|
7902
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
7903
|
+
|
7904
|
+
<xsl:variable name="text2">
|
7905
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
7906
|
+
<xsl:copy-of select="."/>
|
7907
|
+
</xsl:for-each></text>
|
7908
|
+
</xsl:variable>
|
7909
|
+
|
7910
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
7911
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
7912
|
+
<xsl:variable name="text3">
|
7913
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
7914
|
+
<xsl:choose>
|
7915
|
+
<xsl:when test="self::text()">
|
7916
|
+
<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))"/>
|
7917
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
7918
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
7919
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
7920
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
7921
|
+
</xsl:call-template></text></xsl:variable>
|
7922
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
7923
|
+
</xsl:when>
|
7924
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
7925
|
+
</xsl:choose>
|
7926
|
+
</xsl:for-each></text>
|
7927
|
+
</xsl:variable>
|
7928
|
+
|
7929
|
+
<xsl:choose>
|
7930
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
7931
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
7932
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
7933
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
7934
|
+
<xsl:choose>
|
7935
|
+
<xsl:when test="self::text()">
|
7936
|
+
<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))"/>
|
7937
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
7938
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
7939
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
7940
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
7941
|
+
</xsl:call-template></text></xsl:variable>
|
7942
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
7943
|
+
</xsl:when>
|
7944
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
7945
|
+
</xsl:choose>
|
7946
|
+
</xsl:for-each>
|
7947
|
+
</xsl:when>
|
7948
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
7949
|
+
</xsl:choose>
|
7950
|
+
|
7951
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
7952
|
+
<xsl:param name="tag_open"/>
|
7953
|
+
<xsl:param name="tag_close"/>
|
7954
|
+
<xsl:param name="text"/>
|
7955
|
+
<xsl:choose>
|
7956
|
+
<xsl:when test="contains($text, $tag_open)">
|
7957
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
7958
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
7959
|
+
|
7960
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
7961
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
7962
|
+
</xsl:element>
|
7963
|
+
|
7964
|
+
<xsl:call-template name="replace_text_tags">
|
7965
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
7966
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
7967
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
7968
|
+
</xsl:call-template>
|
7969
|
+
</xsl:when>
|
7970
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
7971
|
+
</xsl:choose>
|
7972
|
+
</xsl:template><xsl:template name="printEdition">
|
7973
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
7974
|
+
<xsl:text> </xsl:text>
|
7975
|
+
<xsl:choose>
|
7976
|
+
<xsl:when test="$edition_i18n != ''">
|
7977
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
7978
|
+
<xsl:call-template name="capitalize">
|
7979
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
7980
|
+
</xsl:call-template>
|
7981
|
+
</xsl:when>
|
7982
|
+
<xsl:otherwise>
|
7983
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
7984
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
7985
|
+
<xsl:call-template name="capitalize">
|
7986
|
+
<xsl:with-param name="str">
|
7987
|
+
<xsl:call-template name="getLocalizedString">
|
7988
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
7989
|
+
</xsl:call-template>
|
7990
|
+
</xsl:with-param>
|
7991
|
+
</xsl:call-template>
|
7992
|
+
<xsl:text> </xsl:text>
|
7993
|
+
<xsl:value-of select="$edition"/>
|
7994
|
+
</xsl:if>
|
7995
|
+
</xsl:otherwise>
|
7996
|
+
</xsl:choose>
|
6752
7997
|
</xsl:template><xsl:template name="convertDate">
|
6753
7998
|
<xsl:param name="date"/>
|
6754
7999
|
<xsl:param name="format" select="'short'"/>
|
@@ -7436,4 +8681,40 @@
|
|
7436
8681
|
<xsl:value-of select="$value"/>
|
7437
8682
|
</xsl:otherwise>
|
7438
8683
|
</xsl:choose>
|
8684
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
8685
|
+
<xsl:param name="level">0</xsl:param>
|
8686
|
+
|
8687
|
+
<fo:block margin-left="{2*$level}mm">
|
8688
|
+
<xsl:text>
|
8689
|
+
<</xsl:text>
|
8690
|
+
<xsl:value-of select="local-name()"/>
|
8691
|
+
<xsl:for-each select="@*">
|
8692
|
+
<xsl:text> </xsl:text>
|
8693
|
+
<xsl:value-of select="local-name()"/>
|
8694
|
+
<xsl:text>="</xsl:text>
|
8695
|
+
<xsl:value-of select="."/>
|
8696
|
+
<xsl:text>"</xsl:text>
|
8697
|
+
</xsl:for-each>
|
8698
|
+
<xsl:text>></xsl:text>
|
8699
|
+
|
8700
|
+
<xsl:if test="not(*)">
|
8701
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
8702
|
+
<xsl:text></</xsl:text>
|
8703
|
+
<xsl:value-of select="local-name()"/>
|
8704
|
+
<xsl:text>></xsl:text>
|
8705
|
+
</xsl:if>
|
8706
|
+
</fo:block>
|
8707
|
+
|
8708
|
+
<xsl:if test="*">
|
8709
|
+
<fo:block>
|
8710
|
+
<xsl:apply-templates mode="print_as_xml">
|
8711
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
8712
|
+
</xsl:apply-templates>
|
8713
|
+
</fo:block>
|
8714
|
+
<fo:block margin-left="{2*$level}mm">
|
8715
|
+
<xsl:text></</xsl:text>
|
8716
|
+
<xsl:value-of select="local-name()"/>
|
8717
|
+
<xsl:text>></xsl:text>
|
8718
|
+
</fo:block>
|
8719
|
+
</xsl:if>
|
7439
8720
|
</xsl:template></xsl:stylesheet>
|