metanorma-bipm 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/bipm/base_convert.rb +9 -2
- data/lib/isodoc/bipm/bipm.brochure.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.guide.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.rapport.xsl +1654 -476
- data/lib/isodoc/bipm/doccontrol.rb +101 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +1 -0
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +1615 -370
- data/lib/isodoc/bipm/presentation_xml_convert.rb +18 -93
- data/lib/isodoc/bipm/xref.rb +8 -4
- data/lib/metanorma/bipm/biblio.rng +62 -10
- data/lib/metanorma/bipm/converter.rb +38 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/isodoc.rng +56 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +8 -6
@@ -155,7 +155,13 @@
|
|
155
155
|
|
156
156
|
|
157
157
|
<xsl:template match="/">
|
158
|
-
<fo:root
|
158
|
+
<fo:root xml:lang="{$lang}">
|
159
|
+
<xsl:variable name="root-style">
|
160
|
+
<root-style xsl:use-attribute-sets="root-style"/>
|
161
|
+
</xsl:variable>
|
162
|
+
<xsl:call-template name="insertRootStyle">
|
163
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
164
|
+
</xsl:call-template>
|
159
165
|
<fo:layout-master-set>
|
160
166
|
<!-- cover page -->
|
161
167
|
<fo:simple-page-master master-name="cover-page-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
|
@@ -219,7 +225,7 @@
|
|
219
225
|
<fo:block font-size="10pt" border-bottom="0.5pt solid black" padding-bottom="2.5mm" margin-left="-1mm" space-after="4mm">
|
220
226
|
<!-- Example: First edition July 2009 -->
|
221
227
|
<xsl:call-template name="printEdition"/>
|
222
|
-
<xsl:text>
|
228
|
+
<xsl:text> </xsl:text>
|
223
229
|
<xsl:call-template name="convertDate">
|
224
230
|
<xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:date[@type = 'published']/jcgm:on"/>
|
225
231
|
</xsl:call-template>
|
@@ -481,7 +487,7 @@
|
|
481
487
|
</fo:block>
|
482
488
|
|
483
489
|
<xsl:variable name="edition">
|
484
|
-
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition']">
|
490
|
+
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
|
485
491
|
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
486
492
|
</xsl:apply-templates>
|
487
493
|
</xsl:variable>
|
@@ -670,6 +676,7 @@
|
|
670
676
|
|
671
677
|
<xsl:template match="*[local-name()='p']" name="paragraph">
|
672
678
|
<xsl:param name="inline" select="'false'"/>
|
679
|
+
<xsl:param name="split_keep-within-line"/>
|
673
680
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
674
681
|
<xsl:variable name="element-name">
|
675
682
|
<xsl:choose>
|
@@ -695,7 +702,9 @@
|
|
695
702
|
<xsl:attribute name="widows">1</xsl:attribute>
|
696
703
|
<xsl:attribute name="orphans">1</xsl:attribute>
|
697
704
|
</xsl:if>
|
698
|
-
<xsl:apply-templates
|
705
|
+
<xsl:apply-templates>
|
706
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
707
|
+
</xsl:apply-templates>
|
699
708
|
</xsl:element>
|
700
709
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
701
710
|
<fo:block margin-bottom="12pt">
|
@@ -788,24 +797,6 @@
|
|
788
797
|
</xsl:template>
|
789
798
|
|
790
799
|
|
791
|
-
<xsl:template match="mathml:math" priority="2">
|
792
|
-
<fo:inline font-family="Cambria Math">
|
793
|
-
<xsl:variable name="mathml">
|
794
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
795
|
-
</xsl:variable>
|
796
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
797
|
-
<xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
|
798
|
-
<xsl:attribute name="width">95%</xsl:attribute>
|
799
|
-
<xsl:attribute name="content-height">100%</xsl:attribute>
|
800
|
-
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
801
|
-
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
802
|
-
</xsl:if>
|
803
|
-
<!-- <xsl:copy-of select="."/> -->
|
804
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
805
|
-
</fo:instream-foreign-object>
|
806
|
-
</fo:inline>
|
807
|
-
</xsl:template>
|
808
|
-
|
809
800
|
<!-- for chemical expressions, when prefix superscripted -->
|
810
801
|
<xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() = '' or not(mathml:mtext/text()))]/mathml:mtext" mode="mathml" priority="2">
|
811
802
|
<mathml:mspace height="1ex"/>
|
@@ -899,29 +890,6 @@
|
|
899
890
|
</xsl:template>
|
900
891
|
|
901
892
|
|
902
|
-
<xsl:template name="printEdition">
|
903
|
-
<xsl:variable name="edition" select="normalize-space(//*[local-name()='bibdata']/*[local-name()='edition'])"/>
|
904
|
-
<xsl:text> </xsl:text>
|
905
|
-
<xsl:choose>
|
906
|
-
<xsl:when test="number($edition) = $edition">
|
907
|
-
<xsl:call-template name="number-to-words">
|
908
|
-
<xsl:with-param name="number" select="$edition"/>
|
909
|
-
</xsl:call-template>
|
910
|
-
</xsl:when>
|
911
|
-
<xsl:when test="$edition != ''">
|
912
|
-
<xsl:value-of select="$edition"/>
|
913
|
-
</xsl:when>
|
914
|
-
</xsl:choose>
|
915
|
-
<xsl:variable name="title-edition">
|
916
|
-
<xsl:call-template name="getTitle">
|
917
|
-
<xsl:with-param name="name" select="'title-edition'"/>
|
918
|
-
</xsl:call-template>
|
919
|
-
</xsl:variable>
|
920
|
-
<xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
|
921
|
-
</xsl:template>
|
922
|
-
|
923
|
-
|
924
|
-
|
925
893
|
<!-- ================ -->
|
926
894
|
<!-- JCGM specific templates -->
|
927
895
|
<!-- ================ -->
|
@@ -1146,14 +1114,8 @@
|
|
1146
1114
|
<xsl:param name="font-size" select="'65%'"/>
|
1147
1115
|
<xsl:param name="baseline-shift" select="'30%'"/>
|
1148
1116
|
<xsl:param name="curr_lang" select="'fr'"/>
|
1149
|
-
<xsl:if test="normalize-space (.) != '1'">
|
1117
|
+
<xsl:if test="normalize-space (.) != '1'"> <!-- no need to show '1st edition' -->
|
1150
1118
|
<fo:inline>
|
1151
|
-
<xsl:variable name="title-edition">
|
1152
|
-
<xsl:call-template name="getTitle">
|
1153
|
-
<xsl:with-param name="name" select="'title-edition'"/>
|
1154
|
-
<xsl:with-param name="lang" select="$curr_lang"/>
|
1155
|
-
</xsl:call-template>
|
1156
|
-
</xsl:variable>
|
1157
1119
|
<xsl:value-of select="."/>
|
1158
1120
|
<fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
|
1159
1121
|
<xsl:if test="$curr_lang = 'en'">
|
@@ -1166,7 +1128,9 @@
|
|
1166
1128
|
</xsl:call-template>
|
1167
1129
|
</fo:inline>
|
1168
1130
|
<xsl:text> </xsl:text>
|
1169
|
-
<xsl:
|
1131
|
+
<xsl:call-template name="getLocalizedString">
|
1132
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
1133
|
+
</xsl:call-template>
|
1170
1134
|
<xsl:text/>
|
1171
1135
|
</fo:inline>
|
1172
1136
|
</xsl:if>
|
@@ -1760,7 +1724,9 @@
|
|
1760
1724
|
</fo:block-container>
|
1761
1725
|
</xsl:template>
|
1762
1726
|
|
1763
|
-
<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="
|
1727
|
+
<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_">
|
1728
|
+
false
|
1729
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
1764
1730
|
<xsl:call-template name="getLang"/>
|
1765
1731
|
</xsl:variable><xsl:variable name="pageWidth_">
|
1766
1732
|
210
|
@@ -1775,20 +1741,7 @@
|
|
1775
1741
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
1776
1742
|
23.5
|
1777
1743
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
1778
|
-
|
1779
|
-
<title-edition lang="en">
|
1780
|
-
|
1781
|
-
<xsl:text>Edition </xsl:text>
|
1782
|
-
|
1783
|
-
</title-edition>
|
1784
1744
|
|
1785
|
-
<title-edition lang="fr">
|
1786
|
-
<xsl:text>Édition </xsl:text>
|
1787
|
-
</title-edition>
|
1788
|
-
|
1789
|
-
<title-edition lang="ru">
|
1790
|
-
<xsl:text>Издание </xsl:text>
|
1791
|
-
</title-edition>
|
1792
1745
|
|
1793
1746
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
1794
1747
|
<title-toc lang="en">
|
@@ -1867,7 +1820,7 @@
|
|
1867
1820
|
</xsl:variable><xsl:variable name="bibdata">
|
1868
1821
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
1869
1822
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
1870
|
-
</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">
|
1823
|
+
</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">
|
1871
1824
|
<xsl:param name="name"/>
|
1872
1825
|
<xsl:param name="lang"/>
|
1873
1826
|
<xsl:variable name="lang_">
|
@@ -1910,7 +1863,30 @@
|
|
1910
1863
|
|
1911
1864
|
|
1912
1865
|
|
1913
|
-
</xsl:attribute-set><xsl:
|
1866
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
1867
|
+
<xsl:param name="root-style"/>
|
1868
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
1869
|
+
|
1870
|
+
<xsl:variable name="additional_fonts_">
|
1871
|
+
<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']">
|
1872
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
1873
|
+
</xsl:for-each>
|
1874
|
+
</xsl:variable>
|
1875
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
1876
|
+
|
1877
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
1878
|
+
<xsl:choose>
|
1879
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
1880
|
+
<xsl:attribute name="{local-name()}">
|
1881
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
1882
|
+
</xsl:attribute>
|
1883
|
+
</xsl:when>
|
1884
|
+
<xsl:otherwise>
|
1885
|
+
<xsl:copy-of select="."/>
|
1886
|
+
</xsl:otherwise>
|
1887
|
+
</xsl:choose>
|
1888
|
+
</xsl:for-each>
|
1889
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
1914
1890
|
|
1915
1891
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
1916
1892
|
|
@@ -1967,7 +1943,6 @@
|
|
1967
1943
|
|
1968
1944
|
|
1969
1945
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
1970
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
1971
1946
|
|
1972
1947
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
1973
1948
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -2055,6 +2030,7 @@
|
|
2055
2030
|
|
2056
2031
|
|
2057
2032
|
|
2033
|
+
|
2058
2034
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
2059
2035
|
|
2060
2036
|
|
@@ -2216,6 +2192,7 @@
|
|
2216
2192
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
2217
2193
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2218
2194
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2195
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2219
2196
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
2220
2197
|
|
2221
2198
|
|
@@ -2236,6 +2213,7 @@
|
|
2236
2213
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
2237
2214
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2238
2215
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2216
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2239
2217
|
|
2240
2218
|
|
2241
2219
|
|
@@ -2330,7 +2308,8 @@
|
|
2330
2308
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
2331
2309
|
|
2332
2310
|
|
2333
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
2311
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
2312
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
2334
2313
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
2335
2314
|
|
2336
2315
|
|
@@ -2344,6 +2323,8 @@
|
|
2344
2323
|
|
2345
2324
|
|
2346
2325
|
|
2326
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
2327
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
2347
2328
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
2348
2329
|
|
2349
2330
|
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
@@ -2451,7 +2432,7 @@
|
|
2451
2432
|
|
2452
2433
|
|
2453
2434
|
|
2454
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2435
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2455
2436
|
|
2456
2437
|
|
2457
2438
|
|
@@ -2649,6 +2630,8 @@
|
|
2649
2630
|
</xsl:attribute-set><xsl:attribute-set name="mathml-style">
|
2650
2631
|
<xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
|
2651
2632
|
|
2633
|
+
<xsl:attribute name="font-family">Cambria Math</xsl:attribute>
|
2634
|
+
|
2652
2635
|
|
2653
2636
|
</xsl:attribute-set><xsl:attribute-set name="list-style">
|
2654
2637
|
|
@@ -3159,22 +3142,32 @@
|
|
3159
3142
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3160
3143
|
<xsl:apply-templates select="."/>
|
3161
3144
|
</xsl:for-each>
|
3162
|
-
</xsl:template><xsl:variable name="
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3145
|
+
</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">
|
3146
|
+
|
3147
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3148
|
+
<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))"/>
|
3149
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3150
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3151
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3152
|
+
<xsl:with-param name="text" select="$text"/>
|
3153
|
+
</xsl:call-template>
|
3154
|
+
|
3155
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
3156
|
+
<xsl:param name="tag_open"/>
|
3157
|
+
<xsl:param name="tag_close"/>
|
3169
3158
|
<xsl:param name="text"/>
|
3170
3159
|
<xsl:choose>
|
3171
3160
|
<xsl:when test="contains($text, $tag_open)">
|
3172
3161
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3173
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
3162
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
3174
3163
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3175
|
-
<
|
3176
|
-
|
3177
|
-
|
3164
|
+
<fo:inline keep-together.within-line="always">
|
3165
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3166
|
+
</fo:inline>
|
3167
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
3168
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3169
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
3170
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
3178
3171
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3179
3172
|
</xsl:call-template>
|
3180
3173
|
</xsl:when>
|
@@ -3182,6 +3175,39 @@
|
|
3182
3175
|
</xsl:choose>
|
3183
3176
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3184
3177
|
<xsl:value-of select="$linebreak"/>
|
3178
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
3179
|
+
<xsl:param name="split_keep-within-line"/>
|
3180
|
+
|
3181
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
3182
|
+
<xsl:choose>
|
3183
|
+
|
3184
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
3185
|
+
<xsl:variable name="sep">_</xsl:variable>
|
3186
|
+
<xsl:variable name="items">
|
3187
|
+
<xsl:call-template name="split">
|
3188
|
+
<xsl:with-param name="pText" select="."/>
|
3189
|
+
<xsl:with-param name="sep" select="$sep"/>
|
3190
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
3191
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
3192
|
+
</xsl:call-template>
|
3193
|
+
</xsl:variable>
|
3194
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
3195
|
+
<xsl:choose>
|
3196
|
+
<xsl:when test=". = $sep">
|
3197
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
3198
|
+
</xsl:when>
|
3199
|
+
<xsl:otherwise>
|
3200
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3201
|
+
</xsl:otherwise>
|
3202
|
+
</xsl:choose>
|
3203
|
+
</xsl:for-each>
|
3204
|
+
</xsl:when>
|
3205
|
+
|
3206
|
+
<xsl:otherwise>
|
3207
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3208
|
+
</xsl:otherwise>
|
3209
|
+
|
3210
|
+
</xsl:choose>
|
3185
3211
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
3186
3212
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
3187
3213
|
<xsl:apply-templates/>
|
@@ -3247,8 +3273,23 @@
|
|
3247
3273
|
</xsl:call-template>
|
3248
3274
|
|
3249
3275
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
3250
|
-
|
3251
|
-
|
3276
|
+
<xsl:choose>
|
3277
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
3278
|
+
<xsl:value-of select="."/>
|
3279
|
+
</xsl:when>
|
3280
|
+
<xsl:otherwise>
|
3281
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
3282
|
+
</xsl:otherwise>
|
3283
|
+
</xsl:choose>
|
3284
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
3285
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
3286
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
3287
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
3288
|
+
<xsl:choose>
|
3289
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
3290
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
3291
|
+
</xsl:choose>
|
3292
|
+
</xsl:for-each>
|
3252
3293
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3253
3294
|
|
3254
3295
|
<xsl:variable name="table-preamble">
|
@@ -3258,9 +3299,14 @@
|
|
3258
3299
|
|
3259
3300
|
<xsl:variable name="table">
|
3260
3301
|
|
3261
|
-
<xsl:variable name="simple-table">
|
3262
|
-
<xsl:call-template name="getSimpleTable"
|
3302
|
+
<xsl:variable name="simple-table">
|
3303
|
+
<xsl:call-template name="getSimpleTable">
|
3304
|
+
<xsl:with-param name="id" select="@id"/>
|
3305
|
+
</xsl:call-template>
|
3263
3306
|
</xsl:variable>
|
3307
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
3308
|
+
|
3309
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
3264
3310
|
|
3265
3311
|
|
3266
3312
|
<!-- Display table's name before table as standalone block -->
|
@@ -3279,7 +3325,23 @@
|
|
3279
3325
|
</xsl:call-template>
|
3280
3326
|
</xsl:if>
|
3281
3327
|
</xsl:variable>
|
3282
|
-
<!--
|
3328
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
3329
|
+
|
3330
|
+
<!-- DEBUG -->
|
3331
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3332
|
+
<fo:block font-size="60%">
|
3333
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3334
|
+
</fo:block>
|
3335
|
+
</xsl:if>
|
3336
|
+
|
3337
|
+
|
3338
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
3339
|
+
|
3340
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3341
|
+
DEBUG
|
3342
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3343
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3344
|
+
|
3283
3345
|
|
3284
3346
|
|
3285
3347
|
<xsl:variable name="margin-side">
|
@@ -3344,9 +3406,17 @@
|
|
3344
3406
|
</xsl:element>
|
3345
3407
|
</xsl:variable>
|
3346
3408
|
|
3409
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3410
|
+
<!-- to determine start of table -->
|
3411
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3412
|
+
</xsl:if>
|
3347
3413
|
|
3348
3414
|
<fo:table id="{@id}">
|
3349
3415
|
|
3416
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3417
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3418
|
+
</xsl:if>
|
3419
|
+
|
3350
3420
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
3351
3421
|
<xsl:attribute name="{local-name()}">
|
3352
3422
|
<xsl:value-of select="."/>
|
@@ -3360,31 +3430,47 @@
|
|
3360
3430
|
|
3361
3431
|
|
3362
3432
|
<xsl:choose>
|
3363
|
-
<xsl:when test="
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3433
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3434
|
+
<!-- generate IF for table widths -->
|
3435
|
+
<!-- example:
|
3436
|
+
<tr>
|
3437
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3438
|
+
<p>Symbol</p>
|
3439
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3440
|
+
</td>
|
3441
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3442
|
+
<p>Description</p>
|
3443
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3444
|
+
</td>
|
3445
|
+
</tr>
|
3446
|
+
-->
|
3447
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
3448
|
+
|
3367
3449
|
</xsl:when>
|
3368
3450
|
<xsl:otherwise>
|
3369
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
3370
|
-
<xsl:choose>
|
3371
|
-
<xsl:when test=". = 1 or . = 0">
|
3372
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3373
|
-
</xsl:when>
|
3374
|
-
<xsl:otherwise>
|
3375
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3376
|
-
</xsl:otherwise>
|
3377
|
-
</xsl:choose>
|
3378
|
-
</xsl:for-each>
|
3379
|
-
</xsl:otherwise>
|
3380
|
-
</xsl:choose>
|
3381
3451
|
|
3382
|
-
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3452
|
+
<xsl:choose>
|
3453
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
3454
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
3455
|
+
<fo:table-column column-width="{@width}"/>
|
3456
|
+
</xsl:for-each>
|
3457
|
+
</xsl:when>
|
3458
|
+
<xsl:otherwise>
|
3459
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3460
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3461
|
+
</xsl:call-template>
|
3462
|
+
</xsl:otherwise>
|
3463
|
+
</xsl:choose>
|
3464
|
+
|
3465
|
+
<xsl:choose>
|
3466
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
3467
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
3468
|
+
</xsl:when>
|
3469
|
+
<xsl:otherwise>
|
3470
|
+
<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 -->
|
3471
|
+
</xsl:otherwise>
|
3472
|
+
</xsl:choose>
|
3473
|
+
|
3388
3474
|
</xsl:otherwise>
|
3389
3475
|
</xsl:choose>
|
3390
3476
|
|
@@ -3489,11 +3575,22 @@
|
|
3489
3575
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
3490
3576
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
3491
3577
|
</xsl:template><xsl:template name="calculate-column-widths">
|
3578
|
+
<xsl:param name="table"/>
|
3579
|
+
<xsl:param name="cols-count"/>
|
3580
|
+
|
3581
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
3582
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3583
|
+
<xsl:with-param name="table" select="$table"/>
|
3584
|
+
</xsl:call-template>
|
3585
|
+
|
3586
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
3492
3587
|
<xsl:param name="table"/>
|
3493
3588
|
<xsl:param name="cols-count"/>
|
3494
3589
|
<xsl:param name="curr-col" select="1"/>
|
3495
3590
|
<xsl:param name="width" select="0"/>
|
3496
3591
|
|
3592
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
3593
|
+
|
3497
3594
|
<xsl:if test="$curr-col <= $cols-count">
|
3498
3595
|
<xsl:variable name="widths">
|
3499
3596
|
<xsl:choose>
|
@@ -3531,16 +3628,22 @@
|
|
3531
3628
|
</xsl:for-each>
|
3532
3629
|
</xsl:when>
|
3533
3630
|
<xsl:otherwise>
|
3534
|
-
<xsl:
|
3631
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
3632
|
+
|
3633
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
3634
|
+
-->
|
3635
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
3535
3636
|
<xsl:variable name="td_text">
|
3536
3637
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
3537
3638
|
</xsl:variable>
|
3639
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
3538
3640
|
<xsl:variable name="words">
|
3539
3641
|
<xsl:variable name="string_with_added_zerospaces">
|
3540
3642
|
<xsl:call-template name="add-zero-spaces-java">
|
3541
3643
|
<xsl:with-param name="text" select="$td_text"/>
|
3542
3644
|
</xsl:call-template>
|
3543
3645
|
</xsl:variable>
|
3646
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
3544
3647
|
<xsl:call-template name="tokenize">
|
3545
3648
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
3546
3649
|
<!-- 2009 thinspace -->
|
@@ -3548,11 +3651,13 @@
|
|
3548
3651
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
3549
3652
|
</xsl:call-template>
|
3550
3653
|
</xsl:variable>
|
3654
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
3551
3655
|
<xsl:variable name="max_length">
|
3552
3656
|
<xsl:call-template name="max_length">
|
3553
3657
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3554
3658
|
</xsl:call-template>
|
3555
3659
|
</xsl:variable>
|
3660
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
3556
3661
|
<width>
|
3557
3662
|
<xsl:variable name="divider">
|
3558
3663
|
<xsl:choose>
|
@@ -3571,6 +3676,8 @@
|
|
3571
3676
|
</xsl:choose>
|
3572
3677
|
</xsl:variable>
|
3573
3678
|
|
3679
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
3680
|
+
|
3574
3681
|
<column>
|
3575
3682
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
3576
3683
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -3579,29 +3686,327 @@
|
|
3579
3686
|
</xsl:if>
|
3580
3687
|
</xsl:for-each>
|
3581
3688
|
</column>
|
3582
|
-
<xsl:call-template name="calculate-column-widths">
|
3689
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
3583
3690
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3584
3691
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
3585
3692
|
<xsl:with-param name="table" select="$table"/>
|
3586
3693
|
</xsl:call-template>
|
3587
3694
|
</xsl:if>
|
3695
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
3696
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
3697
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
3698
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
3699
|
+
|
3700
|
+
<!-- if all capitals english letters or digits -->
|
3701
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
3702
|
+
<xsl:call-template name="repeat">
|
3703
|
+
<xsl:with-param name="char" select="'X'"/>
|
3704
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
3705
|
+
</xsl:call-template>
|
3706
|
+
</xsl:if>
|
3588
3707
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
3589
3708
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
3590
3709
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
3591
3710
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
3592
3711
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
3593
3712
|
<xsl:value-of select="@target"/>
|
3594
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
3595
|
-
<xsl:
|
3596
|
-
<xsl:
|
3597
|
-
<xsl:
|
3598
|
-
<xsl:
|
3713
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
3714
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
3715
|
+
<xsl:variable name="mathml_">
|
3716
|
+
<xsl:for-each select="*">
|
3717
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
3718
|
+
<xsl:copy-of select="."/>
|
3719
|
+
</xsl:if>
|
3720
|
+
</xsl:for-each>
|
3721
|
+
</xsl:variable>
|
3722
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
3723
|
+
|
3724
|
+
<xsl:variable name="math_text">
|
3725
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
3726
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
3727
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
3728
|
+
</xsl:variable>
|
3729
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
3730
|
+
</xsl:if>
|
3731
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
3732
|
+
<xsl:param name="table"/>
|
3733
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
3734
|
+
|
3735
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
3736
|
+
|
3737
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
3738
|
+
|
3739
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
3740
|
+
|
3741
|
+
<!-- get current table id -->
|
3742
|
+
<xsl:variable name="table_id" select="@id"/>
|
3743
|
+
<!-- find table by id in the file 'table_widths' -->
|
3744
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
3745
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
3746
|
+
|
3747
|
+
|
3748
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
3749
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
3750
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
3751
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
3752
|
+
|
3753
|
+
<xsl:variable name="table_with_cell_widths_">
|
3754
|
+
<xsl:choose>
|
3755
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
3756
|
+
|
3757
|
+
<!-- Example: <column>10</column>
|
3758
|
+
<column>11</column>
|
3759
|
+
-->
|
3760
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
3761
|
+
</xsl:when>
|
3762
|
+
<xsl:otherwise>
|
3763
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
3764
|
+
</xsl:otherwise>
|
3765
|
+
</xsl:choose>
|
3766
|
+
</xsl:variable>
|
3767
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
3768
|
+
|
3769
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3770
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
3771
|
+
</xsl:if>
|
3772
|
+
|
3773
|
+
|
3774
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
3775
|
+
|
3776
|
+
<xsl:variable name="column_widths_">
|
3777
|
+
<!-- iteration of columns -->
|
3778
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
3779
|
+
<xsl:variable name="pos" select="position()"/>
|
3780
|
+
<column>
|
3781
|
+
<xsl:attribute name="width_max">
|
3782
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
3783
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3784
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3785
|
+
</xsl:for-each>
|
3786
|
+
</xsl:attribute>
|
3787
|
+
<xsl:attribute name="width_min">
|
3788
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
3789
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3790
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3791
|
+
</xsl:for-each>
|
3792
|
+
</xsl:attribute>
|
3793
|
+
</column>
|
3794
|
+
</xsl:for-each>
|
3795
|
+
</xsl:variable>
|
3796
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
3797
|
+
|
3798
|
+
<!-- <column_widths>
|
3799
|
+
<xsl:copy-of select="$column_widths"/>
|
3800
|
+
</column_widths> -->
|
3801
|
+
|
3802
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
3803
|
+
<xsl:variable name="table_widths_">
|
3804
|
+
<table>
|
3805
|
+
<xsl:attribute name="width_max">
|
3806
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
3807
|
+
</xsl:attribute>
|
3808
|
+
<xsl:attribute name="width_min">
|
3809
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
3810
|
+
</xsl:attribute>
|
3811
|
+
</table>
|
3812
|
+
</xsl:variable>
|
3813
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
3814
|
+
|
3815
|
+
<xsl:variable name="page_width">
|
3816
|
+
<xsl:choose>
|
3817
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
3818
|
+
<xsl:otherwise>75</xsl:otherwise>
|
3819
|
+
</xsl:choose>
|
3820
|
+
</xsl:variable>
|
3821
|
+
|
3822
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3823
|
+
<table_width>
|
3824
|
+
<xsl:copy-of select="$table_widths"/>
|
3825
|
+
</table_width>
|
3826
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
3827
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
3828
|
+
-->
|
3829
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
3830
|
+
</xsl:if>
|
3831
|
+
|
3832
|
+
|
3833
|
+
<!-- There are three cases: -->
|
3834
|
+
<xsl:choose>
|
3835
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
3836
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
3837
|
+
<!-- call old algorithm -->
|
3838
|
+
<case1/>
|
3839
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
3840
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
3841
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3842
|
+
<xsl:with-param name="table" select="$table"/>
|
3843
|
+
</xsl:call-template>
|
3844
|
+
</xsl:when>
|
3845
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
3846
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
3847
|
+
<case2/>
|
3848
|
+
<autolayout/>
|
3849
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
3850
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
3851
|
+
</xsl:for-each>
|
3852
|
+
</xsl:when>
|
3853
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
3854
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
3855
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
3856
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
3857
|
+
Now set the column's width to the minimum width plus d times W over D.
|
3858
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
3859
|
+
<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)">
|
3860
|
+
<!-- difference between the available space and the minimum table width -->
|
3861
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
3862
|
+
<W><xsl:value-of select="$W"/></W>
|
3863
|
+
<!-- difference between maximum and minimum width of the table -->
|
3864
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
3865
|
+
<D><xsl:value-of select="$D"/></D>
|
3866
|
+
<case3/>
|
3867
|
+
<autolayout/>
|
3868
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
3869
|
+
<split_keep-within-line>true</split_keep-within-line>
|
3870
|
+
</xsl:if>
|
3871
|
+
<xsl:for-each select="$column_widths/column">
|
3872
|
+
<!-- difference between maximum and minimum width of that column. -->
|
3873
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
3874
|
+
<d><xsl:value-of select="$d"/></d>
|
3875
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
3876
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
3877
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
3878
|
+
<column divider="100">
|
3879
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
3880
|
+
</column>
|
3881
|
+
</xsl:for-each>
|
3882
|
+
|
3883
|
+
</xsl:when>
|
3884
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
3885
|
+
</xsl:choose>
|
3886
|
+
|
3887
|
+
|
3888
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
3889
|
+
<xsl:copy>
|
3890
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
3891
|
+
</xsl:copy>
|
3892
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
3893
|
+
<xsl:copy>
|
3894
|
+
<xsl:copy-of select="@*"/>
|
3895
|
+
|
3896
|
+
<!-- The maximum width is given by the widest line. -->
|
3897
|
+
<xsl:variable name="widths_max">
|
3898
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
3899
|
+
<xsl:call-template name="add_width"/>
|
3900
|
+
</xsl:for-each>
|
3901
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
3902
|
+
<xsl:call-template name="add_width"/>
|
3599
3903
|
</xsl:if>
|
3904
|
+
</xsl:variable>
|
3905
|
+
<xsl:variable name="width_max">
|
3906
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
3907
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3908
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3909
|
+
</xsl:for-each>
|
3910
|
+
</xsl:variable>
|
3911
|
+
<xsl:attribute name="width_max">
|
3912
|
+
<xsl:value-of select="$width_max"/>
|
3913
|
+
</xsl:attribute>
|
3914
|
+
|
3915
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
3916
|
+
<!-- To do: image width -->
|
3917
|
+
<xsl:variable name="td_text">
|
3918
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
3919
|
+
</xsl:variable>
|
3920
|
+
<xsl:variable name="words">
|
3921
|
+
<xsl:variable name="string_with_added_zerospaces">
|
3922
|
+
<xsl:call-template name="add-zero-spaces-java">
|
3923
|
+
<xsl:with-param name="text" select="$td_text"/>
|
3924
|
+
</xsl:call-template>
|
3925
|
+
</xsl:variable>
|
3926
|
+
<xsl:call-template name="tokenize">
|
3927
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
3928
|
+
</xsl:call-template>
|
3929
|
+
</xsl:variable>
|
3930
|
+
|
3931
|
+
<xsl:variable name="max_word_length">
|
3932
|
+
<xsl:call-template name="max_length">
|
3933
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3934
|
+
</xsl:call-template>
|
3935
|
+
</xsl:variable>
|
3936
|
+
<xsl:variable name="width_min">
|
3937
|
+
<xsl:value-of select="$max_word_length"/>
|
3938
|
+
</xsl:variable>
|
3939
|
+
<xsl:attribute name="width_min">
|
3940
|
+
<xsl:value-of select="$width_min"/>
|
3941
|
+
</xsl:attribute>
|
3942
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
3943
|
+
<xsl:if test="$width_min > $width_max">
|
3944
|
+
<xsl:attribute name="width_max">
|
3945
|
+
<xsl:value-of select="$width_min"/>
|
3946
|
+
</xsl:attribute>
|
3947
|
+
</xsl:if>
|
3948
|
+
<xsl:if test="$width_min = 0">
|
3949
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
3950
|
+
</xsl:if>
|
3951
|
+
|
3952
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
3953
|
+
|
3954
|
+
</xsl:copy>
|
3955
|
+
</xsl:template><xsl:template name="add_width">
|
3956
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
3957
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
3958
|
+
|
3959
|
+
<xsl:variable name="p_text_len">
|
3960
|
+
<xsl:choose>
|
3961
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
3962
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
3963
|
+
</xsl:when>
|
3964
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
3965
|
+
</xsl:choose>
|
3966
|
+
</xsl:variable>
|
3967
|
+
|
3968
|
+
<xsl:variable name="math_addon_text">
|
3969
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
3970
|
+
<xsl:apply-templates mode="td_text"/>
|
3600
3971
|
</xsl:for-each>
|
3601
3972
|
</xsl:variable>
|
3973
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
3602
3974
|
|
3603
|
-
<xsl:
|
3604
|
-
|
3975
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
3976
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
3977
|
+
<xsl:copy>
|
3978
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
3979
|
+
</xsl:copy>
|
3980
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
3981
|
+
<xsl:copy>
|
3982
|
+
<xsl:copy-of select="@*"/>
|
3983
|
+
|
3984
|
+
<!-- The maximum width is given by the widest line. -->
|
3985
|
+
<xsl:attribute name="width_max">
|
3986
|
+
<xsl:for-each select="p_len">
|
3987
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3988
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3989
|
+
</xsl:for-each>
|
3990
|
+
</xsl:attribute>
|
3991
|
+
|
3992
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
3993
|
+
<xsl:variable name="width_min">
|
3994
|
+
<xsl:for-each select="word_len">
|
3995
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3996
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3997
|
+
</xsl:for-each>
|
3998
|
+
</xsl:variable>
|
3999
|
+
<xsl:attribute name="width_min">
|
4000
|
+
<xsl:value-of select="$width_min"/>
|
4001
|
+
</xsl:attribute>
|
4002
|
+
|
4003
|
+
<xsl:if test="$width_min = 0">
|
4004
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
4005
|
+
</xsl:if>
|
4006
|
+
|
4007
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
4008
|
+
|
4009
|
+
</xsl:copy>
|
3605
4010
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
3606
4011
|
<xsl:param name="cols-count"/>
|
3607
4012
|
<fo:table-header>
|
@@ -3699,16 +4104,10 @@
|
|
3699
4104
|
</xsl:for-each>
|
3700
4105
|
</xsl:when>
|
3701
4106
|
<xsl:otherwise>
|
3702
|
-
|
3703
|
-
|
3704
|
-
|
3705
|
-
|
3706
|
-
</xsl:when>
|
3707
|
-
<xsl:otherwise>
|
3708
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3709
|
-
</xsl:otherwise>
|
3710
|
-
</xsl:choose>
|
3711
|
-
</xsl:for-each>
|
4107
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4108
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4109
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4110
|
+
</xsl:call-template>
|
3712
4111
|
</xsl:otherwise>
|
3713
4112
|
</xsl:choose>
|
3714
4113
|
|
@@ -3830,6 +4229,52 @@
|
|
3830
4229
|
|
3831
4230
|
</fo:table-body>
|
3832
4231
|
|
4232
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
4233
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
4234
|
+
<xsl:apply-templates mode="process_table-if">
|
4235
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
4236
|
+
</xsl:apply-templates>
|
4237
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
4238
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
4239
|
+
|
4240
|
+
<fo:table-body>
|
4241
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
4242
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
4243
|
+
|
4244
|
+
<!-- iteration for each tr/td -->
|
4245
|
+
|
4246
|
+
<xsl:choose>
|
4247
|
+
<xsl:when test="$table_or_dl = 'table'">
|
4248
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
4249
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
4250
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
4251
|
+
<xsl:call-template name="td"/>
|
4252
|
+
</fo:table-row>
|
4253
|
+
</xsl:for-each>
|
4254
|
+
</xsl:when>
|
4255
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
4256
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
4257
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
4258
|
+
|
4259
|
+
<xsl:for-each select="*">
|
4260
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
4261
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
4262
|
+
<xsl:choose>
|
4263
|
+
<xsl:when test="$is_dt">
|
4264
|
+
<xsl:call-template name="insert_dt_cell"/>
|
4265
|
+
</xsl:when>
|
4266
|
+
<xsl:otherwise>
|
4267
|
+
<xsl:call-template name="insert_dd_cell"/>
|
4268
|
+
</xsl:otherwise>
|
4269
|
+
</xsl:choose>
|
4270
|
+
</fo:table-row>
|
4271
|
+
</xsl:for-each>
|
4272
|
+
</xsl:for-each>
|
4273
|
+
</xsl:otherwise>
|
4274
|
+
</xsl:choose>
|
4275
|
+
|
4276
|
+
</xsl:for-each>
|
4277
|
+
</fo:table-body>
|
3833
4278
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
3834
4279
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
3835
4280
|
|
@@ -3927,7 +4372,7 @@
|
|
3927
4372
|
</xsl:choose>
|
3928
4373
|
</xsl:attribute>
|
3929
4374
|
</xsl:if>
|
3930
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
4375
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
3931
4376
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
3932
4377
|
<xsl:call-template name="setTextAlignment">
|
3933
4378
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -3968,11 +4413,24 @@
|
|
3968
4413
|
|
3969
4414
|
<xsl:call-template name="setTableCellAttributes"/>
|
3970
4415
|
|
4416
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4417
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
4418
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
4419
|
+
</xsl:if>
|
4420
|
+
|
3971
4421
|
<fo:block>
|
3972
4422
|
|
4423
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4424
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
4425
|
+
</xsl:if>
|
4426
|
+
|
4427
|
+
|
3973
4428
|
|
3974
4429
|
|
3975
4430
|
<xsl:apply-templates/>
|
4431
|
+
|
4432
|
+
<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"/> -->
|
4433
|
+
|
3976
4434
|
</fo:block>
|
3977
4435
|
</fo:table-cell>
|
3978
4436
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -4169,9 +4627,9 @@
|
|
4169
4627
|
<!-- current hierarchy is 'figure' element -->
|
4170
4628
|
<xsl:variable name="following_dl_colwidths">
|
4171
4629
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
4172
|
-
<xsl:variable name="
|
4173
|
-
<xsl:variable name="doc_ns">
|
4174
|
-
|
4630
|
+
<xsl:variable name="simple-table">
|
4631
|
+
<!-- <xsl:variable name="doc_ns">
|
4632
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
4175
4633
|
</xsl:variable>
|
4176
4634
|
<xsl:variable name="ns">
|
4177
4635
|
<xsl:choose>
|
@@ -4182,7 +4640,7 @@
|
|
4182
4640
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
4183
4641
|
</xsl:otherwise>
|
4184
4642
|
</xsl:choose>
|
4185
|
-
</xsl:variable>
|
4643
|
+
</xsl:variable> -->
|
4186
4644
|
|
4187
4645
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4188
4646
|
<tbody>
|
@@ -4193,7 +4651,7 @@
|
|
4193
4651
|
|
4194
4652
|
<xsl:call-template name="calculate-column-widths">
|
4195
4653
|
<xsl:with-param name="cols-count" select="2"/>
|
4196
|
-
<xsl:with-param name="table" select="$
|
4654
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
4197
4655
|
</xsl:call-template>
|
4198
4656
|
|
4199
4657
|
</xsl:if>
|
@@ -4319,8 +4777,10 @@
|
|
4319
4777
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
4320
4778
|
</xsl:variable>
|
4321
4779
|
|
4780
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
4781
|
+
|
4322
4782
|
<xsl:choose>
|
4323
|
-
<xsl:when test="$
|
4783
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
4324
4784
|
|
4325
4785
|
<fo:block margin-bottom="12pt" text-align="left">
|
4326
4786
|
|
@@ -4337,7 +4797,7 @@
|
|
4337
4797
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
4338
4798
|
</fo:block>
|
4339
4799
|
|
4340
|
-
</xsl:when>
|
4800
|
+
</xsl:when> <!-- END: only one component -->
|
4341
4801
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4342
4802
|
<fo:block margin-bottom="12pt" text-align="left">
|
4343
4803
|
|
@@ -4353,8 +4813,8 @@
|
|
4353
4813
|
</xsl:variable>
|
4354
4814
|
<xsl:value-of select="$title-where"/>
|
4355
4815
|
</fo:block>
|
4356
|
-
</xsl:when>
|
4357
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
4816
|
+
</xsl:when> <!-- END: a few components -->
|
4817
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
4358
4818
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
4359
4819
|
|
4360
4820
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
@@ -4370,11 +4830,11 @@
|
|
4370
4830
|
</xsl:variable>
|
4371
4831
|
<xsl:value-of select="$title-key"/>
|
4372
4832
|
</fo:block>
|
4373
|
-
</xsl:when>
|
4833
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
4374
4834
|
</xsl:choose>
|
4375
4835
|
|
4376
4836
|
<!-- a few components -->
|
4377
|
-
<xsl:if test="
|
4837
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
4378
4838
|
<fo:block>
|
4379
4839
|
|
4380
4840
|
<xsl:if test="$parent = 'formula'">
|
@@ -4390,7 +4850,18 @@
|
|
4390
4850
|
|
4391
4851
|
|
4392
4852
|
|
4853
|
+
|
4854
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4855
|
+
<!-- to determine start of table -->
|
4856
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
4857
|
+
</xsl:if>
|
4858
|
+
|
4393
4859
|
<fo:table width="95%" table-layout="fixed">
|
4860
|
+
|
4861
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4862
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
4863
|
+
</xsl:if>
|
4864
|
+
|
4394
4865
|
|
4395
4866
|
<xsl:choose>
|
4396
4867
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -4399,54 +4870,143 @@
|
|
4399
4870
|
|
4400
4871
|
</xsl:when>
|
4401
4872
|
</xsl:choose>
|
4402
|
-
|
4403
|
-
|
4404
|
-
|
4873
|
+
|
4874
|
+
|
4875
|
+
<xsl:choose>
|
4876
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4877
|
+
<!-- generate IF for table widths -->
|
4878
|
+
<!-- example:
|
4879
|
+
<tr>
|
4880
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
4881
|
+
<p>Symbol</p>
|
4882
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
4883
|
+
</td>
|
4884
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
4885
|
+
<p>Description</p>
|
4886
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
4887
|
+
</td>
|
4888
|
+
</tr>
|
4889
|
+
-->
|
4405
4890
|
|
4406
|
-
|
4407
|
-
|
4408
|
-
|
4409
|
-
<xsl:
|
4410
|
-
<
|
4411
|
-
|
4412
|
-
|
4413
|
-
|
4414
|
-
|
4415
|
-
|
4416
|
-
|
4417
|
-
|
4418
|
-
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
|
4428
|
-
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
|
4433
|
-
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4891
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
4892
|
+
<xsl:variable name="simple-table">
|
4893
|
+
|
4894
|
+
<xsl:variable name="dl_table">
|
4895
|
+
<tbody>
|
4896
|
+
<xsl:apply-templates mode="dl_if">
|
4897
|
+
<xsl:with-param name="id" select="@id"/>
|
4898
|
+
</xsl:apply-templates>
|
4899
|
+
</tbody>
|
4900
|
+
</xsl:variable>
|
4901
|
+
|
4902
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
4903
|
+
|
4904
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
4905
|
+
<xsl:variable name="table_without_br">
|
4906
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
4907
|
+
</xsl:variable>
|
4908
|
+
|
4909
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
4910
|
+
|
4911
|
+
<!-- Step: add id to each cell -->
|
4912
|
+
<!-- add <word>...</word> for each word, image, math -->
|
4913
|
+
<xsl:variable name="simple-table-id">
|
4914
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
4915
|
+
<xsl:with-param name="id" select="@id"/>
|
4916
|
+
</xsl:apply-templates>
|
4917
|
+
</xsl:variable>
|
4918
|
+
|
4919
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
4920
|
+
|
4921
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
4922
|
+
|
4923
|
+
</xsl:variable>
|
4924
|
+
|
4925
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
4926
|
+
|
4927
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
4928
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
4929
|
+
</xsl:apply-templates>
|
4930
|
+
|
4931
|
+
</xsl:when>
|
4932
|
+
<xsl:otherwise>
|
4933
|
+
|
4934
|
+
<xsl:variable name="simple-table">
|
4935
|
+
|
4936
|
+
<xsl:variable name="dl_table">
|
4937
|
+
<tbody>
|
4938
|
+
<xsl:apply-templates mode="dl">
|
4939
|
+
<xsl:with-param name="id" select="@id"/>
|
4940
|
+
</xsl:apply-templates>
|
4941
|
+
</tbody>
|
4942
|
+
</xsl:variable>
|
4943
|
+
|
4944
|
+
<xsl:copy-of select="$dl_table"/>
|
4945
|
+
</xsl:variable>
|
4946
|
+
|
4947
|
+
<xsl:variable name="colwidths">
|
4948
|
+
<xsl:call-template name="calculate-column-widths">
|
4949
|
+
<xsl:with-param name="cols-count" select="2"/>
|
4950
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
4951
|
+
</xsl:call-template>
|
4952
|
+
</xsl:variable>
|
4953
|
+
|
4954
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
4955
|
+
DEBUG
|
4956
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
4957
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
4958
|
+
|
4959
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4960
|
+
|
4961
|
+
<xsl:variable name="maxlength_dt">
|
4962
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
4963
|
+
</xsl:variable>
|
4964
|
+
|
4965
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
4966
|
+
false
|
4967
|
+
</xsl:variable>
|
4968
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
4969
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
4970
|
+
|
4971
|
+
|
4972
|
+
<xsl:call-template name="setColumnWidth_dl">
|
4973
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4974
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4975
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
4976
|
+
</xsl:call-template>
|
4977
|
+
|
4978
|
+
<fo:table-body>
|
4979
|
+
|
4980
|
+
<!-- DEBUG -->
|
4981
|
+
<xsl:if test="$table_if_debug = 'true'">
|
4982
|
+
<fo:table-row>
|
4983
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
4984
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
4985
|
+
</fo:table-cell>
|
4986
|
+
</fo:table-row>
|
4987
|
+
</xsl:if>
|
4988
|
+
|
4989
|
+
<xsl:apply-templates>
|
4990
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
4991
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
4992
|
+
</xsl:apply-templates>
|
4993
|
+
|
4994
|
+
</fo:table-body>
|
4995
|
+
</xsl:otherwise>
|
4996
|
+
</xsl:choose>
|
4441
4997
|
</fo:table>
|
4442
4998
|
</fo:block>
|
4443
4999
|
</fo:block>
|
4444
|
-
</xsl:if>
|
5000
|
+
</xsl:if> <!-- END: a few components -->
|
4445
5001
|
</fo:block-container>
|
4446
5002
|
</fo:block-container>
|
4447
5003
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
4448
5004
|
<xsl:param name="colwidths"/>
|
4449
5005
|
<xsl:param name="maxlength_dt"/>
|
5006
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
5007
|
+
|
5008
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
5009
|
+
|
4450
5010
|
<xsl:choose>
|
4451
5011
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
4452
5012
|
<fo:table-column column-width="50%"/>
|
@@ -4454,6 +5014,16 @@
|
|
4454
5014
|
</xsl:when>
|
4455
5015
|
<xsl:otherwise>
|
4456
5016
|
<xsl:choose>
|
5017
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
5018
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5019
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5020
|
+
</xsl:call-template>
|
5021
|
+
</xsl:when>
|
5022
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
5023
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5024
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5025
|
+
</xsl:call-template>
|
5026
|
+
</xsl:when>
|
4457
5027
|
<!-- to set width check most wide chars like `W` -->
|
4458
5028
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
4459
5029
|
<fo:table-column column-width="7%"/>
|
@@ -4484,20 +5054,31 @@
|
|
4484
5054
|
<fo:table-column column-width="60%"/>
|
4485
5055
|
</xsl:when>
|
4486
5056
|
<xsl:otherwise>
|
4487
|
-
<xsl:
|
4488
|
-
<xsl:
|
4489
|
-
|
4490
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
4491
|
-
</xsl:when>
|
4492
|
-
<xsl:otherwise>
|
4493
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4494
|
-
</xsl:otherwise>
|
4495
|
-
</xsl:choose>
|
4496
|
-
</xsl:for-each>
|
5057
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5058
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5059
|
+
</xsl:call-template>
|
4497
5060
|
</xsl:otherwise>
|
4498
5061
|
</xsl:choose>
|
4499
5062
|
</xsl:otherwise>
|
4500
5063
|
</xsl:choose>
|
5064
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
5065
|
+
<xsl:param name="colwidths"/>
|
5066
|
+
|
5067
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
5068
|
+
<xsl:choose>
|
5069
|
+
<xsl:when test=". = 1 or . = 0">
|
5070
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
5071
|
+
</xsl:when>
|
5072
|
+
<xsl:otherwise>
|
5073
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
5074
|
+
<xsl:variable name="divider">
|
5075
|
+
<xsl:value-of select="@divider"/>
|
5076
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
5077
|
+
</xsl:variable>
|
5078
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
5079
|
+
</xsl:otherwise>
|
5080
|
+
</xsl:choose>
|
5081
|
+
</xsl:for-each>
|
4501
5082
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
4502
5083
|
<xsl:variable name="lengths">
|
4503
5084
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -4521,7 +5102,6 @@
|
|
4521
5102
|
<xsl:value-of select="$maxLength"/>
|
4522
5103
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
4523
5104
|
<xsl:param name="key_iso"/>
|
4524
|
-
|
4525
5105
|
<!-- <tr>
|
4526
5106
|
<td>NOTE</td>
|
4527
5107
|
<td>
|
@@ -4529,27 +5109,47 @@
|
|
4529
5109
|
</td>
|
4530
5110
|
</tr>
|
4531
5111
|
-->
|
4532
|
-
|
5112
|
+
<!-- OLD Variant -->
|
5113
|
+
<!-- <fo:table-row>
|
4533
5114
|
<fo:table-cell>
|
4534
5115
|
<fo:block margin-top="6pt">
|
4535
5116
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4536
5117
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4537
5118
|
</xsl:if>
|
4538
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
5119
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
4539
5120
|
</fo:block>
|
4540
5121
|
</fo:table-cell>
|
4541
5122
|
<fo:table-cell>
|
4542
5123
|
<fo:block>
|
4543
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
5124
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
5125
|
+
</fo:block>
|
5126
|
+
</fo:table-cell>
|
5127
|
+
</fo:table-row> -->
|
5128
|
+
<!-- <tr>
|
5129
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
5130
|
+
</tr>
|
5131
|
+
-->
|
5132
|
+
<fo:table-row>
|
5133
|
+
<fo:table-cell number-columns-spanned="2">
|
5134
|
+
<fo:block>
|
5135
|
+
<xsl:call-template name="note"/>
|
4544
5136
|
</fo:block>
|
4545
5137
|
</fo:table-cell>
|
4546
5138
|
</fo:table-row>
|
4547
5139
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
5140
|
+
<xsl:param name="id"/>
|
5141
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
4548
5142
|
<tr>
|
4549
5143
|
<td>
|
5144
|
+
<xsl:attribute name="id">
|
5145
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
5146
|
+
</xsl:attribute>
|
4550
5147
|
<xsl:apply-templates/>
|
4551
5148
|
</td>
|
4552
5149
|
<td>
|
5150
|
+
<xsl:attribute name="id">
|
5151
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
5152
|
+
</xsl:attribute>
|
4553
5153
|
|
4554
5154
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
4555
5155
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -4560,50 +5160,122 @@
|
|
4560
5160
|
|
4561
5161
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
4562
5162
|
<xsl:param name="key_iso"/>
|
5163
|
+
<xsl:param name="split_keep-within-line"/>
|
4563
5164
|
|
4564
5165
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
4565
|
-
<
|
5166
|
+
<xsl:call-template name="insert_dt_cell">
|
5167
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
5168
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5169
|
+
</xsl:call-template>
|
5170
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
5171
|
+
<xsl:call-template name="insert_dd_cell">
|
5172
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5173
|
+
</xsl:call-template>
|
5174
|
+
</xsl:for-each>
|
5175
|
+
</fo:table-row>
|
5176
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
5177
|
+
<xsl:param name="key_iso"/>
|
5178
|
+
<xsl:param name="split_keep-within-line"/>
|
5179
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
5180
|
+
|
5181
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5182
|
+
<!-- border is mandatory, to calculate real width -->
|
5183
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
5184
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
5185
|
+
</xsl:if>
|
5186
|
+
|
5187
|
+
|
5188
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
5189
|
+
<xsl:copy-of select="@id"/>
|
5190
|
+
|
5191
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
5192
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
5193
|
+
</xsl:if>
|
5194
|
+
|
5195
|
+
|
5196
|
+
|
5197
|
+
<xsl:apply-templates>
|
5198
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5199
|
+
</xsl:apply-templates>
|
5200
|
+
|
5201
|
+
<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"/> -->
|
5202
|
+
|
5203
|
+
</fo:block>
|
5204
|
+
</fo:table-cell>
|
5205
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
5206
|
+
<xsl:param name="split_keep-within-line"/>
|
5207
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
5208
|
+
|
5209
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5210
|
+
<!-- border is mandatory, to calculate real width -->
|
5211
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
5212
|
+
</xsl:if>
|
5213
|
+
|
5214
|
+
<fo:block>
|
5215
|
+
|
5216
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5217
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
5218
|
+
</xsl:if>
|
5219
|
+
|
4566
5220
|
|
4567
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
4568
|
-
<xsl:copy-of select="@id"/>
|
4569
|
-
|
4570
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4571
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4572
|
-
</xsl:if>
|
4573
|
-
|
4574
|
-
|
4575
|
-
|
4576
|
-
<xsl:apply-templates/>
|
4577
|
-
</fo:block>
|
4578
|
-
</fo:table-cell>
|
4579
|
-
<fo:table-cell>
|
4580
|
-
<fo:block>
|
4581
|
-
|
4582
5221
|
|
4583
|
-
|
4584
|
-
|
4585
|
-
|
4586
|
-
|
4587
|
-
|
4588
|
-
|
5222
|
+
<xsl:choose>
|
5223
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5224
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
5225
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
5226
|
+
</xsl:apply-templates>
|
5227
|
+
</xsl:when>
|
5228
|
+
<xsl:otherwise>
|
5229
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
5230
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
5231
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5232
|
+
</xsl:apply-templates>
|
5233
|
+
</xsl:otherwise>
|
5234
|
+
|
5235
|
+
</xsl:choose>
|
5236
|
+
|
5237
|
+
<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"/> -->
|
5238
|
+
|
5239
|
+
</fo:block>
|
5240
|
+
</fo:table-cell>
|
4589
5241
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
4590
5242
|
<xsl:apply-templates/>
|
4591
5243
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
4592
5244
|
<xsl:param name="process">false</xsl:param>
|
5245
|
+
<xsl:param name="split_keep-within-line"/>
|
4593
5246
|
<xsl:if test="$process = 'true'">
|
4594
5247
|
<xsl:apply-templates select="@language"/>
|
4595
|
-
<xsl:apply-templates
|
5248
|
+
<xsl:apply-templates>
|
5249
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5250
|
+
</xsl:apply-templates>
|
4596
5251
|
</xsl:if>
|
4597
5252
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
4598
5253
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
4599
|
-
</xsl:template><xsl:template match="*[local-name()='
|
5254
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
5255
|
+
<xsl:param name="id"/>
|
5256
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
5257
|
+
<tr>
|
5258
|
+
<td>
|
5259
|
+
<xsl:copy-of select="node()"/>
|
5260
|
+
</td>
|
5261
|
+
<td>
|
5262
|
+
|
5263
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
5264
|
+
|
5265
|
+
</td>
|
5266
|
+
</tr>
|
5267
|
+
|
5268
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
4600
5269
|
<fo:inline font-style="italic">
|
4601
5270
|
<xsl:apply-templates/>
|
4602
5271
|
</fo:inline>
|
4603
5272
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
5273
|
+
<xsl:param name="split_keep-within-line"/>
|
4604
5274
|
<fo:inline font-weight="bold">
|
4605
5275
|
|
4606
|
-
<xsl:apply-templates
|
5276
|
+
<xsl:apply-templates>
|
5277
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5278
|
+
</xsl:apply-templates>
|
4607
5279
|
</fo:inline>
|
4608
5280
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
4609
5281
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -4642,13 +5314,15 @@
|
|
4642
5314
|
<xsl:choose>
|
4643
5315
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4644
5316
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4645
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
5317
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4646
5318
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4647
5319
|
</xsl:choose>
|
4648
5320
|
</xsl:attribute>
|
4649
5321
|
</xsl:if>
|
4650
5322
|
<xsl:apply-templates/>
|
4651
5323
|
</fo:inline>
|
5324
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
5325
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
4652
5326
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
4653
5327
|
<fo:inline text-decoration="underline">
|
4654
5328
|
<xsl:apply-templates/>
|
@@ -4796,54 +5470,120 @@
|
|
4796
5470
|
<fo:block break-after="page"/>
|
4797
5471
|
<fo:block> </fo:block>
|
4798
5472
|
<fo:block break-after="page"/>
|
5473
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
5474
|
+
<xsl:apply-templates/>
|
4799
5475
|
</xsl:template><xsl:template name="tokenize">
|
4800
5476
|
<xsl:param name="text"/>
|
4801
5477
|
<xsl:param name="separator" select="' '"/>
|
4802
5478
|
<xsl:choose>
|
5479
|
+
|
5480
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
5481
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
5482
|
+
</xsl:when>
|
4803
5483
|
<xsl:when test="not(contains($text, $separator))">
|
4804
5484
|
<word>
|
4805
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4806
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4807
5485
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
4808
|
-
<xsl:variable name="len_str">
|
4809
|
-
<xsl:choose>
|
4810
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4811
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4812
|
-
</xsl:when>
|
4813
|
-
<xsl:otherwise>
|
4814
|
-
<xsl:value-of select="$len_str_tmp"/>
|
4815
|
-
</xsl:otherwise>
|
4816
|
-
</xsl:choose>
|
4817
|
-
</xsl:variable>
|
4818
|
-
|
4819
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4820
|
-
<xsl:message>
|
4821
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4822
|
-
len_str=<xsl:value-of select="$len_str"/>
|
4823
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4824
|
-
</xsl:message>
|
4825
|
-
</xsl:if> -->
|
4826
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4827
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4828
5486
|
<xsl:choose>
|
4829
|
-
<xsl:when test="$
|
4830
|
-
<xsl:value-of select="$
|
5487
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
5488
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4831
5489
|
</xsl:when>
|
4832
5490
|
<xsl:otherwise>
|
4833
|
-
<xsl:
|
5491
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5492
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5493
|
+
<xsl:variable name="len_str">
|
5494
|
+
<xsl:choose>
|
5495
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5496
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5497
|
+
</xsl:when>
|
5498
|
+
<xsl:otherwise>
|
5499
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5500
|
+
</xsl:otherwise>
|
5501
|
+
</xsl:choose>
|
5502
|
+
</xsl:variable>
|
5503
|
+
|
5504
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5505
|
+
<xsl:message>
|
5506
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5507
|
+
len_str=<xsl:value-of select="$len_str"/>
|
5508
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5509
|
+
</xsl:message>
|
5510
|
+
</xsl:if> -->
|
5511
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5512
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5513
|
+
<xsl:choose>
|
5514
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
5515
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
5516
|
+
</xsl:when>
|
5517
|
+
<xsl:otherwise>
|
5518
|
+
<xsl:value-of select="$len_str"/>
|
5519
|
+
</xsl:otherwise>
|
5520
|
+
</xsl:choose>
|
4834
5521
|
</xsl:otherwise>
|
4835
5522
|
</xsl:choose>
|
4836
5523
|
</word>
|
4837
5524
|
</xsl:when>
|
4838
5525
|
<xsl:otherwise>
|
4839
5526
|
<word>
|
4840
|
-
<xsl:
|
5527
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
5528
|
+
<xsl:choose>
|
5529
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5530
|
+
<xsl:value-of select="$word"/>
|
5531
|
+
</xsl:when>
|
5532
|
+
<xsl:otherwise>
|
5533
|
+
<xsl:value-of select="string-length($word)"/>
|
5534
|
+
</xsl:otherwise>
|
5535
|
+
</xsl:choose>
|
4841
5536
|
</word>
|
4842
5537
|
<xsl:call-template name="tokenize">
|
4843
5538
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
4844
5539
|
</xsl:call-template>
|
4845
5540
|
</xsl:otherwise>
|
4846
5541
|
</xsl:choose>
|
5542
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
5543
|
+
<xsl:param name="tags"/>
|
5544
|
+
<xsl:param name="text"/>
|
5545
|
+
<xsl:param name="separator" select="' '"/>
|
5546
|
+
<xsl:choose>
|
5547
|
+
|
5548
|
+
<xsl:when test="not(contains($text, $separator))">
|
5549
|
+
<word>
|
5550
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5551
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
5552
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5553
|
+
</xsl:call-template>
|
5554
|
+
</word>
|
5555
|
+
</xsl:when>
|
5556
|
+
<xsl:otherwise>
|
5557
|
+
<word>
|
5558
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5559
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
5560
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5561
|
+
</xsl:call-template>
|
5562
|
+
</word>
|
5563
|
+
<xsl:call-template name="tokenize_with_tags">
|
5564
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
5565
|
+
</xsl:call-template>
|
5566
|
+
</xsl:otherwise>
|
5567
|
+
</xsl:choose>
|
5568
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
5569
|
+
<xsl:param name="text"/>
|
5570
|
+
<xsl:param name="tags"/>
|
5571
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
5572
|
+
|
5573
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
5574
|
+
|
5575
|
+
<xsl:choose>
|
5576
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
5577
|
+
<xsl:otherwise>
|
5578
|
+
<xsl:element name="{$tag_name}">
|
5579
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5580
|
+
<xsl:with-param name="text" select="$text"/>
|
5581
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5582
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
5583
|
+
</xsl:call-template>
|
5584
|
+
</xsl:element>
|
5585
|
+
</xsl:otherwise>
|
5586
|
+
</xsl:choose>
|
4847
5587
|
</xsl:template><xsl:template name="max_length">
|
4848
5588
|
<xsl:param name="words"/>
|
4849
5589
|
<xsl:for-each select="$words//word">
|
@@ -4916,36 +5656,47 @@
|
|
4916
5656
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
4917
5657
|
<xsl:param name="text" select="."/>
|
4918
5658
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
5659
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
4919
5660
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
5661
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
4920
5662
|
<xsl:variable name="zero-space"></xsl:variable>
|
4921
5663
|
<xsl:choose>
|
4922
5664
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
4923
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
5665
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
4924
5666
|
<xsl:value-of select="$zero-space-after-equals"/>
|
4925
5667
|
<xsl:value-of select="$zero-space"/>
|
4926
5668
|
<xsl:call-template name="add-zero-spaces-equal">
|
4927
5669
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
4928
|
-
</xsl:call-template>
|
5670
|
+
</xsl:call-template> -->
|
5671
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
4929
5672
|
</xsl:when>
|
4930
5673
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
4931
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
5674
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
4932
5675
|
<xsl:value-of select="$zero-space-after-equal"/>
|
4933
5676
|
<xsl:value-of select="$zero-space"/>
|
4934
5677
|
<xsl:call-template name="add-zero-spaces-equal">
|
4935
5678
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
4936
|
-
</xsl:call-template>
|
5679
|
+
</xsl:call-template> -->
|
5680
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
4937
5681
|
</xsl:when>
|
4938
5682
|
<xsl:otherwise>
|
4939
5683
|
<xsl:value-of select="$text"/>
|
4940
5684
|
</xsl:otherwise>
|
4941
5685
|
</xsl:choose>
|
4942
5686
|
</xsl:template><xsl:template name="getSimpleTable">
|
5687
|
+
<xsl:param name="id"/>
|
5688
|
+
|
4943
5689
|
<xsl:variable name="simple-table">
|
4944
5690
|
|
5691
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
5692
|
+
<xsl:variable name="table_without_br">
|
5693
|
+
<xsl:apply-templates mode="table-without-br"/>
|
5694
|
+
</xsl:variable>
|
5695
|
+
|
4945
5696
|
<!-- Step 1. colspan processing -->
|
4946
5697
|
<xsl:variable name="simple-table-colspan">
|
4947
5698
|
<tbody>
|
4948
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
5699
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
4949
5700
|
</tbody>
|
4950
5701
|
</xsl:variable>
|
4951
5702
|
|
@@ -4954,10 +5705,67 @@
|
|
4954
5705
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
4955
5706
|
</xsl:variable>
|
4956
5707
|
|
4957
|
-
|
4958
|
-
|
5708
|
+
<!-- Step 3: add id to each cell -->
|
5709
|
+
<!-- add <word>...</word> for each word, image, math -->
|
5710
|
+
<xsl:variable name="simple-table-id">
|
5711
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
5712
|
+
<xsl:with-param name="id" select="$id"/>
|
5713
|
+
</xsl:apply-templates>
|
5714
|
+
</xsl:variable>
|
5715
|
+
|
5716
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
5717
|
+
|
4959
5718
|
</xsl:variable>
|
4960
5719
|
<xsl:copy-of select="$simple-table"/>
|
5720
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
5721
|
+
<xsl:copy>
|
5722
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
5723
|
+
</xsl:copy>
|
5724
|
+
</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">
|
5725
|
+
<xsl:copy>
|
5726
|
+
<xsl:copy-of select="@*"/>
|
5727
|
+
<p>
|
5728
|
+
<xsl:copy-of select="node()"/>
|
5729
|
+
</p>
|
5730
|
+
</xsl:copy>
|
5731
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
5732
|
+
<xsl:copy>
|
5733
|
+
<xsl:copy-of select="@*"/>
|
5734
|
+
<xsl:for-each select="*[local-name()='br']">
|
5735
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
5736
|
+
<p>
|
5737
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
5738
|
+
<xsl:copy-of select="."/>
|
5739
|
+
</xsl:for-each>
|
5740
|
+
</p>
|
5741
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
5742
|
+
<p>
|
5743
|
+
<xsl:for-each select="following-sibling::node()">
|
5744
|
+
<xsl:copy-of select="."/>
|
5745
|
+
</xsl:for-each>
|
5746
|
+
</p>
|
5747
|
+
</xsl:if>
|
5748
|
+
</xsl:for-each>
|
5749
|
+
</xsl:copy>
|
5750
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
5751
|
+
<xsl:for-each select="*[local-name()='br']">
|
5752
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
5753
|
+
<p>
|
5754
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
5755
|
+
<xsl:copy-of select="."/>
|
5756
|
+
</xsl:for-each>
|
5757
|
+
</p>
|
5758
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
5759
|
+
<p>
|
5760
|
+
<xsl:for-each select="following-sibling::node()">
|
5761
|
+
<xsl:copy-of select="."/>
|
5762
|
+
</xsl:for-each>
|
5763
|
+
</p>
|
5764
|
+
</xsl:if>
|
5765
|
+
</xsl:for-each>
|
5766
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
5767
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
5768
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
4961
5769
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
4962
5770
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
4963
5771
|
</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">
|
@@ -5006,47 +5814,167 @@
|
|
5006
5814
|
<xsl:copy>
|
5007
5815
|
<xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
|
5008
5816
|
</xsl:copy>
|
5009
|
-
</xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
|
5817
|
+
</xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
|
5818
|
+
<xsl:copy>
|
5819
|
+
<xsl:copy-of select="tr[1]"/>
|
5820
|
+
<xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
|
5821
|
+
<xsl:with-param name="previousRow" select="tr[1]"/>
|
5822
|
+
</xsl:apply-templates>
|
5823
|
+
</xsl:copy>
|
5824
|
+
</xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
|
5825
|
+
<xsl:param name="previousRow"/>
|
5826
|
+
<xsl:variable name="currentRow" select="."/>
|
5827
|
+
|
5828
|
+
<xsl:variable name="normalizedTDs">
|
5829
|
+
<xsl:for-each select="xalan:nodeset($previousRow)//td">
|
5830
|
+
<xsl:choose>
|
5831
|
+
<xsl:when test="@rowspan > 1">
|
5832
|
+
<xsl:copy>
|
5833
|
+
<xsl:attribute name="rowspan">
|
5834
|
+
<xsl:value-of select="@rowspan - 1"/>
|
5835
|
+
</xsl:attribute>
|
5836
|
+
<xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
|
5837
|
+
<xsl:copy-of select="node()"/>
|
5838
|
+
</xsl:copy>
|
5839
|
+
</xsl:when>
|
5840
|
+
<xsl:otherwise>
|
5841
|
+
<xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
|
5842
|
+
</xsl:otherwise>
|
5843
|
+
</xsl:choose>
|
5844
|
+
</xsl:for-each>
|
5845
|
+
</xsl:variable>
|
5846
|
+
|
5847
|
+
<xsl:variable name="newRow">
|
5848
|
+
<xsl:copy>
|
5849
|
+
<xsl:copy-of select="$currentRow/@*"/>
|
5850
|
+
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
5851
|
+
</xsl:copy>
|
5852
|
+
</xsl:variable>
|
5853
|
+
<xsl:copy-of select="$newRow"/>
|
5854
|
+
|
5855
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
5856
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
5857
|
+
</xsl:apply-templates>
|
5858
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
5859
|
+
<xsl:param name="id"/>
|
5860
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
5861
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
5862
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
5863
|
+
</xsl:apply-templates>
|
5864
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
5865
|
+
<xsl:param name="id"/>
|
5866
|
+
<xsl:copy>
|
5867
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
5868
|
+
<xsl:with-param name="id" select="$id"/>
|
5869
|
+
</xsl:apply-templates>
|
5870
|
+
</xsl:copy>
|
5871
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
5872
|
+
<xsl:param name="id"/>
|
5873
|
+
<xsl:copy>
|
5874
|
+
<xsl:copy-of select="@*"/>
|
5875
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
5876
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
5877
|
+
<xsl:with-param name="id" select="$id"/>
|
5878
|
+
</xsl:apply-templates>
|
5879
|
+
</xsl:copy>
|
5880
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
5881
|
+
<xsl:param name="id"/>
|
5882
|
+
<xsl:copy>
|
5883
|
+
<xsl:copy-of select="@*"/>
|
5884
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
5885
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
5886
|
+
<xsl:attribute name="id">
|
5887
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
5888
|
+
</xsl:attribute>
|
5889
|
+
|
5890
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
5891
|
+
<xsl:copy>
|
5892
|
+
<xsl:copy-of select="@*"/>
|
5893
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
5894
|
+
<xsl:attribute name="id">
|
5895
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
5896
|
+
</xsl:attribute>
|
5897
|
+
|
5898
|
+
<xsl:copy-of select="node()"/>
|
5899
|
+
</xsl:copy>
|
5900
|
+
</xsl:for-each>
|
5901
|
+
|
5902
|
+
|
5903
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
5904
|
+
|
5905
|
+
<xsl:variable name="td_text">
|
5906
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
5907
|
+
</xsl:variable>
|
5908
|
+
|
5909
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
5910
|
+
|
5911
|
+
<xsl:variable name="words">
|
5912
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
5913
|
+
<word>
|
5914
|
+
<xsl:copy-of select="."/>
|
5915
|
+
</word>
|
5916
|
+
</xsl:for-each>
|
5917
|
+
|
5918
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
5919
|
+
<xsl:copy-of select="."/>
|
5920
|
+
</xsl:for-each>
|
5921
|
+
|
5922
|
+
</xsl:variable>
|
5923
|
+
|
5924
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
5925
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
5926
|
+
<xsl:copy>
|
5927
|
+
<xsl:attribute name="id">
|
5928
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
5929
|
+
</xsl:attribute>
|
5930
|
+
<xsl:copy-of select="node()"/>
|
5931
|
+
</xsl:copy>
|
5932
|
+
</xsl:for-each>
|
5933
|
+
</xsl:if>
|
5934
|
+
</xsl:copy>
|
5935
|
+
|
5936
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
5010
5937
|
<xsl:copy>
|
5011
|
-
<xsl:
|
5012
|
-
<xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
|
5013
|
-
<xsl:with-param name="previousRow" select="tr[1]"/>
|
5014
|
-
</xsl:apply-templates>
|
5938
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
5015
5939
|
</xsl:copy>
|
5016
|
-
</xsl:template><xsl:template match="
|
5017
|
-
<xsl:
|
5018
|
-
|
5019
|
-
|
5020
|
-
<xsl:variable name="normalizedTDs">
|
5021
|
-
<xsl:for-each select="xalan:nodeset($previousRow)//td">
|
5022
|
-
<xsl:choose>
|
5023
|
-
<xsl:when test="@rowspan > 1">
|
5024
|
-
<xsl:copy>
|
5025
|
-
<xsl:attribute name="rowspan">
|
5026
|
-
<xsl:value-of select="@rowspan - 1"/>
|
5027
|
-
</xsl:attribute>
|
5028
|
-
<xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
|
5029
|
-
<xsl:copy-of select="node()"/>
|
5030
|
-
</xsl:copy>
|
5031
|
-
</xsl:when>
|
5032
|
-
<xsl:otherwise>
|
5033
|
-
<xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
|
5034
|
-
</xsl:otherwise>
|
5035
|
-
</xsl:choose>
|
5036
|
-
</xsl:for-each>
|
5940
|
+
</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">
|
5941
|
+
<xsl:variable name="formatting_tags">
|
5942
|
+
<xsl:call-template name="getFormattingTags"/>
|
5037
5943
|
</xsl:variable>
|
5038
|
-
|
5039
|
-
|
5040
|
-
<xsl:
|
5041
|
-
|
5042
|
-
|
5043
|
-
|
5944
|
+
<word>
|
5945
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5946
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
5947
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
5948
|
+
</xsl:call-template>
|
5949
|
+
</word>
|
5950
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
5951
|
+
|
5952
|
+
<xsl:variable name="td_text" select="."/>
|
5953
|
+
|
5954
|
+
<xsl:variable name="string_with_added_zerospaces">
|
5955
|
+
<xsl:call-template name="add-zero-spaces-java">
|
5956
|
+
<xsl:with-param name="text" select="$td_text"/>
|
5957
|
+
</xsl:call-template>
|
5044
5958
|
</xsl:variable>
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5048
|
-
|
5049
|
-
|
5959
|
+
|
5960
|
+
<xsl:variable name="formatting_tags">
|
5961
|
+
<xsl:call-template name="getFormattingTags"/>
|
5962
|
+
</xsl:variable>
|
5963
|
+
|
5964
|
+
<!-- <word>text</word> -->
|
5965
|
+
<xsl:call-template name="tokenize_with_tags">
|
5966
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
5967
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
5968
|
+
</xsl:call-template>
|
5969
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
5970
|
+
<tags>
|
5971
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
5972
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
5973
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
5974
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
5975
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
5976
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
5977
|
+
</tags>
|
5050
5978
|
</xsl:template><xsl:template name="getLang">
|
5051
5979
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
5052
5980
|
<xsl:variable name="language">
|
@@ -5101,6 +6029,9 @@
|
|
5101
6029
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
5102
6030
|
|
5103
6031
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
6032
|
+
|
6033
|
+
|
6034
|
+
|
5104
6035
|
|
5105
6036
|
|
5106
6037
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -5108,48 +6039,87 @@
|
|
5108
6039
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5109
6040
|
</xsl:call-template>
|
5110
6041
|
|
6042
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
6043
|
+
<!-- insert helper tag -->
|
6044
|
+
<!-- set unique font-size (fiction) -->
|
6045
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
6046
|
+
<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 -->
|
6047
|
+
</xsl:if>
|
5111
6048
|
|
5112
|
-
|
5113
|
-
|
5114
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
6049
|
+
<xsl:variable name="mathml_content">
|
6050
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5115
6051
|
</xsl:variable>
|
5116
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
5117
6052
|
|
6053
|
+
|
6054
|
+
<xsl:call-template name="mathml_instream_object">
|
6055
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
6056
|
+
</xsl:call-template>
|
5118
6057
|
|
5119
|
-
|
5120
|
-
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5130
|
-
</xsl:
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5134
|
-
|
5135
|
-
|
5136
|
-
|
5137
|
-
|
6058
|
+
|
6059
|
+
</fo:inline>
|
6060
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
6061
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
6062
|
+
<xsl:variable name="comment_text_">
|
6063
|
+
<xsl:choose>
|
6064
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
6065
|
+
<xsl:value-of select="$comment_text_following"/>
|
6066
|
+
</xsl:when>
|
6067
|
+
<xsl:otherwise>
|
6068
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
6069
|
+
</xsl:otherwise>
|
6070
|
+
</xsl:choose>
|
6071
|
+
</xsl:variable>
|
6072
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
6073
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
6074
|
+
<xsl:value-of select="$comment_text"/>
|
6075
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
6076
|
+
<xsl:param name="comment_text"/>
|
6077
|
+
<xsl:param name="mathml_content"/>
|
6078
|
+
|
6079
|
+
<xsl:variable name="comment_text_">
|
6080
|
+
<xsl:choose>
|
6081
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
6082
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
6083
|
+
</xsl:choose>
|
6084
|
+
</xsl:variable>
|
6085
|
+
|
6086
|
+
<xsl:variable name="mathml">
|
6087
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
6088
|
+
</xsl:variable>
|
6089
|
+
|
6090
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
6091
|
+
|
6092
|
+
|
6093
|
+
|
6094
|
+
|
6095
|
+
|
6096
|
+
|
6097
|
+
<xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
|
6098
|
+
<xsl:attribute name="width">95%</xsl:attribute>
|
6099
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
6100
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
6101
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
5138
6102
|
</xsl:if>
|
5139
|
-
|
5140
|
-
|
5141
|
-
|
5142
|
-
|
5143
|
-
|
5144
|
-
<xsl:
|
5145
|
-
|
6103
|
+
|
6104
|
+
|
6105
|
+
<!-- put MathML in Actual Text -->
|
6106
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
6107
|
+
<xsl:attribute name="fox:actual-text">
|
6108
|
+
<xsl:value-of select="$mathml_content"/>
|
6109
|
+
</xsl:attribute>
|
6110
|
+
|
6111
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
6112
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
6113
|
+
<!-- put Mathin Alternate Text -->
|
6114
|
+
<xsl:attribute name="fox:alt-text">
|
6115
|
+
<xsl:value-of select="$comment_text_"/>
|
5146
6116
|
</xsl:attribute>
|
5147
|
-
|
5148
|
-
|
5149
|
-
|
5150
|
-
|
5151
|
-
|
5152
|
-
</fo:
|
6117
|
+
</xsl:if>
|
6118
|
+
<!-- </xsl:if> -->
|
6119
|
+
|
6120
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
6121
|
+
|
6122
|
+
</fo:instream-foreign-object>
|
5153
6123
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
5154
6124
|
<!-- <xsl:text>a+b</xsl:text> -->
|
5155
6125
|
<xsl:text><</xsl:text>
|
@@ -5180,7 +6150,9 @@
|
|
5180
6150
|
<!-- replace start and end spaces to non-break space -->
|
5181
6151
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
5182
6152
|
</xsl:copy>
|
5183
|
-
</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="
|
6153
|
+
</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">
|
6154
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
6155
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
5184
6156
|
<xsl:variable name="target">
|
5185
6157
|
<xsl:choose>
|
5186
6158
|
<xsl:when test="@updatetype = 'true'">
|
@@ -5409,7 +6381,12 @@
|
|
5409
6381
|
|
5410
6382
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
5411
6383
|
|
6384
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
6385
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
6386
|
+
</xsl:if>
|
6387
|
+
|
5412
6388
|
|
6389
|
+
|
5413
6390
|
|
5414
6391
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
5415
6392
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -5768,18 +6745,33 @@
|
|
5768
6745
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
5769
6746
|
<xsl:copy>
|
5770
6747
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
5771
|
-
<xsl:variable name="
|
6748
|
+
<xsl:variable name="viewbox_">
|
5772
6749
|
<xsl:call-template name="split">
|
5773
6750
|
<xsl:with-param name="pText" select="@viewBox"/>
|
5774
6751
|
<xsl:with-param name="sep" select="' '"/>
|
5775
6752
|
</xsl:call-template>
|
5776
6753
|
</xsl:variable>
|
6754
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
6755
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
6756
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
6757
|
+
|
5777
6758
|
<xsl:attribute name="width">
|
5778
|
-
<xsl:
|
6759
|
+
<xsl:choose>
|
6760
|
+
<xsl:when test="$width != ''">
|
6761
|
+
<xsl:value-of select="round($width)"/>
|
6762
|
+
</xsl:when>
|
6763
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
6764
|
+
</xsl:choose>
|
5779
6765
|
</xsl:attribute>
|
5780
6766
|
<xsl:attribute name="height">
|
5781
|
-
<xsl:
|
6767
|
+
<xsl:choose>
|
6768
|
+
<xsl:when test="$height != ''">
|
6769
|
+
<xsl:value-of select="round($height)"/>
|
6770
|
+
</xsl:when>
|
6771
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
6772
|
+
</xsl:choose>
|
5782
6773
|
</xsl:attribute>
|
6774
|
+
|
5783
6775
|
<xsl:apply-templates mode="svg_update"/>
|
5784
6776
|
</xsl:copy>
|
5785
6777
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -5974,7 +6966,11 @@
|
|
5974
6966
|
<xsl:apply-templates mode="bookmarks"/>
|
5975
6967
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
5976
6968
|
<xsl:apply-templates select="."/>
|
5977
|
-
</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() = '
|
6969
|
+
</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">
|
6970
|
+
<xsl:apply-templates mode="contents"/>
|
6971
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
6972
|
+
<xsl:apply-templates mode="bookmarks"/>
|
6973
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
5978
6974
|
<xsl:apply-templates mode="bookmarks"/>
|
5979
6975
|
</xsl:template><xsl:template name="addBookmarks">
|
5980
6976
|
<xsl:param name="contents"/>
|
@@ -6256,7 +7252,9 @@
|
|
6256
7252
|
<xsl:apply-templates/>
|
6257
7253
|
</xsl:otherwise>
|
6258
7254
|
</xsl:choose>
|
6259
|
-
</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() = '
|
7255
|
+
</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">
|
7256
|
+
<xsl:value-of select="."/>
|
7257
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
6260
7258
|
<xsl:text> </xsl:text>
|
6261
7259
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
6262
7260
|
<xsl:copy>
|
@@ -6287,9 +7285,22 @@
|
|
6287
7285
|
</xsl:when>
|
6288
7286
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
6289
7287
|
</xsl:choose>
|
7288
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
7289
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
7290
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
7291
|
+
<xsl:apply-templates mode="contents_item"/>
|
6290
7292
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
6291
7293
|
|
6292
7294
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
7295
|
+
|
7296
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
7297
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7298
|
+
</xsl:if>
|
7299
|
+
|
7300
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
7301
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7302
|
+
</xsl:if>
|
7303
|
+
|
6293
7304
|
<xsl:copy-of select="@id"/>
|
6294
7305
|
|
6295
7306
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -6389,17 +7400,15 @@
|
|
6389
7400
|
|
6390
7401
|
<!-- split text by zero-width space -->
|
6391
7402
|
<xsl:variable name="text_step4">
|
6392
|
-
<xsl:call-template name="
|
7403
|
+
<xsl:call-template name="split_for_interspers">
|
6393
7404
|
<xsl:with-param name="pText" select="$text_step3"/>
|
6394
7405
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
6395
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
6396
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
6397
7406
|
</xsl:call-template>
|
6398
7407
|
</xsl:variable>
|
6399
7408
|
|
6400
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
7409
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
6401
7410
|
<xsl:choose>
|
6402
|
-
<xsl:when test="
|
7411
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
6403
7412
|
<xsl:call-template name="interspers">
|
6404
7413
|
<xsl:with-param name="str" select="."/>
|
6405
7414
|
</xsl:call-template>
|
@@ -6410,6 +7419,30 @@
|
|
6410
7419
|
</xsl:choose>
|
6411
7420
|
</xsl:for-each>
|
6412
7421
|
|
7422
|
+
</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">
|
7423
|
+
<xsl:param name="pText" select="."/>
|
7424
|
+
<xsl:param name="sep" select="','"/>
|
7425
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
7426
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
7427
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
7428
|
+
<xsl:call-template name="replace_tag_interspers">
|
7429
|
+
<xsl:with-param name="text" select="$text"/>
|
7430
|
+
</xsl:call-template>
|
7431
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
7432
|
+
<xsl:param name="text"/>
|
7433
|
+
<xsl:choose>
|
7434
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
7435
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
7436
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
7437
|
+
<interspers>
|
7438
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
7439
|
+
</interspers>
|
7440
|
+
<xsl:call-template name="replace_tag_interspers">
|
7441
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
7442
|
+
</xsl:call-template>
|
7443
|
+
</xsl:when>
|
7444
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
7445
|
+
</xsl:choose>
|
6413
7446
|
</xsl:template><xsl:template name="interspers">
|
6414
7447
|
<xsl:param name="str"/>
|
6415
7448
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -6638,7 +7671,9 @@
|
|
6638
7671
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
6639
7672
|
</xsl:if>
|
6640
7673
|
<xsl:variable name="simple-table">
|
6641
|
-
<xsl:call-template name="getSimpleTable"
|
7674
|
+
<xsl:call-template name="getSimpleTable">
|
7675
|
+
<xsl:with-param name="id" select="@id"/>
|
7676
|
+
</xsl:call-template>
|
6642
7677
|
</xsl:variable>
|
6643
7678
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
6644
7679
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -6745,39 +7780,67 @@
|
|
6745
7780
|
</xsl:otherwise>
|
6746
7781
|
</xsl:choose>
|
6747
7782
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
6748
|
-
|
6749
|
-
|
7783
|
+
|
7784
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
7785
|
+
|
6750
7786
|
|
7787
|
+
|
6751
7788
|
<xsl:variable name="fo_element">
|
6752
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
7789
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
6753
7790
|
inline
|
6754
7791
|
</xsl:variable>
|
6755
7792
|
|
6756
|
-
|
6757
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
6758
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6759
|
-
</xsl:apply-templates>
|
7793
|
+
<fo:block-container margin-left="0mm">
|
6760
7794
|
|
6761
|
-
|
6762
|
-
|
6763
|
-
<
|
6764
|
-
|
6765
|
-
|
7795
|
+
<xsl:choose>
|
7796
|
+
|
7797
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
7798
|
+
|
7799
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
7800
|
+
<fo:block>
|
7801
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6766
7802
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6767
7803
|
</xsl:apply-templates>
|
7804
|
+
</fo:block>
|
7805
|
+
|
7806
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7807
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7808
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
7809
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7810
|
+
</xsl:apply-templates>
|
7811
|
+
</fo:block-container>
|
6768
7812
|
</fo:block-container>
|
6769
|
-
</
|
6770
|
-
|
6771
|
-
|
6772
|
-
|
6773
|
-
|
6774
|
-
|
6775
|
-
|
6776
|
-
|
6777
|
-
|
6778
|
-
|
6779
|
-
|
6780
|
-
|
7813
|
+
</xsl:when> <!-- end block -->
|
7814
|
+
|
7815
|
+
<xsl:otherwise> <!-- inline -->
|
7816
|
+
|
7817
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
7818
|
+
<fo:block>
|
7819
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
7820
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7821
|
+
</xsl:apply-templates>
|
7822
|
+
<fo:inline>
|
7823
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
7824
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7825
|
+
</xsl:apply-templates>
|
7826
|
+
</fo:inline>
|
7827
|
+
</fo:block>
|
7828
|
+
|
7829
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
7830
|
+
<!-- display further elements in blocks -->
|
7831
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7832
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7833
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
7834
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
7835
|
+
</xsl:apply-templates>
|
7836
|
+
</fo:block-container>
|
7837
|
+
</fo:block-container>
|
7838
|
+
</xsl:if>
|
7839
|
+
</xsl:otherwise> <!-- end inline -->
|
7840
|
+
|
7841
|
+
</xsl:choose>
|
7842
|
+
</fo:block-container>
|
7843
|
+
</fo:block-container>
|
6781
7844
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
6782
7845
|
<xsl:param name="fo_element">block</xsl:param>
|
6783
7846
|
|
@@ -6814,10 +7877,16 @@
|
|
6814
7877
|
</xsl:variable>
|
6815
7878
|
<xsl:choose>
|
6816
7879
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
6817
|
-
<fo:block
|
6818
|
-
|
6819
|
-
|
6820
|
-
|
7880
|
+
<fo:block-container>
|
7881
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
7882
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7883
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7884
|
+
</xsl:if>
|
7885
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
7886
|
+
|
7887
|
+
<xsl:apply-templates/>
|
7888
|
+
</fo:block>
|
7889
|
+
</fo:block-container>
|
6821
7890
|
</xsl:when>
|
6822
7891
|
<xsl:otherwise>
|
6823
7892
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -6862,7 +7931,7 @@
|
|
6862
7931
|
</xsl:otherwise>
|
6863
7932
|
</xsl:choose> -->
|
6864
7933
|
</fo:block>
|
6865
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
7934
|
+
</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">
|
6866
7935
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
6867
7936
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
6868
7937
|
<xsl:if test="normalize-space() != ''">
|
@@ -7006,7 +8075,16 @@
|
|
7006
8075
|
</fo:inline>
|
7007
8076
|
</xsl:when>
|
7008
8077
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
7009
|
-
|
8078
|
+
|
8079
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
8080
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
8081
|
+
<xsl:choose>
|
8082
|
+
<xsl:when test="$uri_src != ''">
|
8083
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
8084
|
+
</xsl:when>
|
8085
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
8086
|
+
</xsl:choose>
|
8087
|
+
|
7010
8088
|
</xsl:otherwise>
|
7011
8089
|
</xsl:choose>
|
7012
8090
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -7186,10 +8264,24 @@
|
|
7186
8264
|
|
7187
8265
|
</fo:block>
|
7188
8266
|
<xsl:apply-templates/>
|
7189
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
8267
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
7190
8268
|
<!-- comment 2019-11-29 -->
|
7191
8269
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
7192
8270
|
<xsl:apply-templates /> -->
|
8271
|
+
|
8272
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
8273
|
+
|
8274
|
+
<xsl:choose>
|
8275
|
+
<!-- if there isn't the attribute '@from', then -->
|
8276
|
+
<xsl:when test="$id_from = ''">
|
8277
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
8278
|
+
</xsl:when>
|
8279
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
8280
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
8281
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
8282
|
+
</xsl:when>
|
8283
|
+
</xsl:choose>
|
8284
|
+
|
7193
8285
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
7194
8286
|
<!-- 0xA0 to space replacement -->
|
7195
8287
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -7548,7 +8640,10 @@
|
|
7548
8640
|
<!-- to split by '_' and other chars -->
|
7549
8641
|
<xsl:call-template name="add-zero-spaces-java"/>
|
7550
8642
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
7551
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
8643
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
8644
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
8645
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
8646
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
7552
8647
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
7553
8648
|
<!-- <row>
|
7554
8649
|
<date>05-07-2013</date>
|
@@ -8094,6 +9189,120 @@
|
|
8094
9189
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8095
9190
|
</xsl:for-each>
|
8096
9191
|
</xsl:copy>
|
9192
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
9193
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
9194
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
9195
|
+
<xsl:copy>
|
9196
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
9197
|
+
</xsl:copy>
|
9198
|
+
</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">
|
9199
|
+
|
9200
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
9201
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
9202
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
9203
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
9204
|
+
<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))"/>
|
9205
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
9206
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9207
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9208
|
+
<xsl:with-param name="text" select="$text_"/>
|
9209
|
+
</xsl:call-template></text></xsl:variable>
|
9210
|
+
|
9211
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
9212
|
+
|
9213
|
+
<xsl:variable name="text2">
|
9214
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
9215
|
+
<xsl:copy-of select="."/>
|
9216
|
+
</xsl:for-each></text>
|
9217
|
+
</xsl:variable>
|
9218
|
+
|
9219
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
9220
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
9221
|
+
<xsl:variable name="text3">
|
9222
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
9223
|
+
<xsl:choose>
|
9224
|
+
<xsl:when test="self::text()">
|
9225
|
+
<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))"/>
|
9226
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
9227
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9228
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9229
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
9230
|
+
</xsl:call-template></text></xsl:variable>
|
9231
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
9232
|
+
</xsl:when>
|
9233
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
9234
|
+
</xsl:choose>
|
9235
|
+
</xsl:for-each></text>
|
9236
|
+
</xsl:variable>
|
9237
|
+
|
9238
|
+
<xsl:choose>
|
9239
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
9240
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
9241
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
9242
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
9243
|
+
<xsl:choose>
|
9244
|
+
<xsl:when test="self::text()">
|
9245
|
+
<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))"/>
|
9246
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
9247
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9248
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9249
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
9250
|
+
</xsl:call-template></text></xsl:variable>
|
9251
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
9252
|
+
</xsl:when>
|
9253
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
9254
|
+
</xsl:choose>
|
9255
|
+
</xsl:for-each>
|
9256
|
+
</xsl:when>
|
9257
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
9258
|
+
</xsl:choose>
|
9259
|
+
|
9260
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
9261
|
+
<xsl:param name="tag_open"/>
|
9262
|
+
<xsl:param name="tag_close"/>
|
9263
|
+
<xsl:param name="text"/>
|
9264
|
+
<xsl:choose>
|
9265
|
+
<xsl:when test="contains($text, $tag_open)">
|
9266
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
9267
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
9268
|
+
|
9269
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
9270
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
9271
|
+
</xsl:element>
|
9272
|
+
|
9273
|
+
<xsl:call-template name="replace_text_tags">
|
9274
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
9275
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
9276
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
9277
|
+
</xsl:call-template>
|
9278
|
+
</xsl:when>
|
9279
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
9280
|
+
</xsl:choose>
|
9281
|
+
</xsl:template><xsl:template name="printEdition">
|
9282
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
9283
|
+
<xsl:text> </xsl:text>
|
9284
|
+
<xsl:choose>
|
9285
|
+
<xsl:when test="$edition_i18n != ''">
|
9286
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
9287
|
+
<xsl:call-template name="capitalize">
|
9288
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
9289
|
+
</xsl:call-template>
|
9290
|
+
</xsl:when>
|
9291
|
+
<xsl:otherwise>
|
9292
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
9293
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
9294
|
+
<xsl:call-template name="capitalize">
|
9295
|
+
<xsl:with-param name="str">
|
9296
|
+
<xsl:call-template name="getLocalizedString">
|
9297
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
9298
|
+
</xsl:call-template>
|
9299
|
+
</xsl:with-param>
|
9300
|
+
</xsl:call-template>
|
9301
|
+
<xsl:text> </xsl:text>
|
9302
|
+
<xsl:value-of select="$edition"/>
|
9303
|
+
</xsl:if>
|
9304
|
+
</xsl:otherwise>
|
9305
|
+
</xsl:choose>
|
8097
9306
|
</xsl:template><xsl:template name="convertDate">
|
8098
9307
|
<xsl:param name="date"/>
|
8099
9308
|
<xsl:param name="format" select="'short'"/>
|
@@ -8778,4 +9987,40 @@
|
|
8778
9987
|
<xsl:value-of select="$value"/>
|
8779
9988
|
</xsl:otherwise>
|
8780
9989
|
</xsl:choose>
|
9990
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
9991
|
+
<xsl:param name="level">0</xsl:param>
|
9992
|
+
|
9993
|
+
<fo:block margin-left="{2*$level}mm">
|
9994
|
+
<xsl:text>
|
9995
|
+
<</xsl:text>
|
9996
|
+
<xsl:value-of select="local-name()"/>
|
9997
|
+
<xsl:for-each select="@*">
|
9998
|
+
<xsl:text> </xsl:text>
|
9999
|
+
<xsl:value-of select="local-name()"/>
|
10000
|
+
<xsl:text>="</xsl:text>
|
10001
|
+
<xsl:value-of select="."/>
|
10002
|
+
<xsl:text>"</xsl:text>
|
10003
|
+
</xsl:for-each>
|
10004
|
+
<xsl:text>></xsl:text>
|
10005
|
+
|
10006
|
+
<xsl:if test="not(*)">
|
10007
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
10008
|
+
<xsl:text></</xsl:text>
|
10009
|
+
<xsl:value-of select="local-name()"/>
|
10010
|
+
<xsl:text>></xsl:text>
|
10011
|
+
</xsl:if>
|
10012
|
+
</fo:block>
|
10013
|
+
|
10014
|
+
<xsl:if test="*">
|
10015
|
+
<fo:block>
|
10016
|
+
<xsl:apply-templates mode="print_as_xml">
|
10017
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
10018
|
+
</xsl:apply-templates>
|
10019
|
+
</fo:block>
|
10020
|
+
<fo:block margin-left="{2*$level}mm">
|
10021
|
+
<xsl:text></</xsl:text>
|
10022
|
+
<xsl:value-of select="local-name()"/>
|
10023
|
+
<xsl:text>></xsl:text>
|
10024
|
+
</fo:block>
|
10025
|
+
</xsl:if>
|
8781
10026
|
</xsl:template></xsl:stylesheet>
|