metanorma-cc 2.0.8 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/cc/cc.standard.xsl +1643 -337
- data/lib/isodoc/cc/html/cc.css +18 -11
- data/lib/isodoc/cc/html/cc.scss +16 -8
- data/lib/isodoc/cc/html/html_cc_titlepage.html +2 -0
- data/lib/isodoc/cc/html/htmlstyle.css +6 -0
- data/lib/isodoc/cc/html/htmlstyle.scss +1 -0
- data/lib/isodoc/cc/html/word_cc_titlepage.html +8 -3
- data/lib/isodoc/cc/init.rb +2 -2
- data/lib/metanorma/cc/biblio.rng +69 -42
- data/lib/metanorma/cc/isodoc.rng +65 -0
- data/lib/metanorma/cc/version.rb +1 -1
- data/metanorma-cc.gemspec +1 -1
- metadata +5 -7
- data/docs/navigation.adoc +0 -8
- data/docs/quickstart.adoc +0 -368
@@ -455,6 +455,7 @@
|
|
455
455
|
|
456
456
|
<xsl:template match="csd:p" name="paragraph">
|
457
457
|
<xsl:param name="inline" select="'false'"/>
|
458
|
+
<xsl:param name="split_keep-within-line"/>
|
458
459
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
459
460
|
<xsl:variable name="element-name">
|
460
461
|
<xsl:choose>
|
@@ -480,7 +481,9 @@
|
|
480
481
|
</xsl:choose>
|
481
482
|
</xsl:attribute>
|
482
483
|
<xsl:attribute name="line-height">115%</xsl:attribute>
|
483
|
-
<xsl:apply-templates
|
484
|
+
<xsl:apply-templates>
|
485
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
486
|
+
</xsl:apply-templates>
|
484
487
|
</xsl:element>
|
485
488
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
486
489
|
<fo:block margin-bottom="12pt">
|
@@ -566,12 +569,41 @@
|
|
566
569
|
</xsl:template>
|
567
570
|
|
568
571
|
|
569
|
-
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="
|
572
|
+
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
|
573
|
+
<xsl:for-each select="$table_widths_from_if//table">
|
574
|
+
<xsl:copy>
|
575
|
+
<xsl:copy-of select="@*"/>
|
576
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
|
577
|
+
</xsl:copy>
|
578
|
+
</xsl:for-each>
|
579
|
+
</xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
580
|
+
false
|
581
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
570
582
|
<xsl:call-template name="getLang"/>
|
571
|
-
</xsl:variable><xsl:variable name="
|
572
|
-
|
583
|
+
</xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
|
584
|
+
<xsl:choose>
|
585
|
+
<xsl:when test="$papersize = 'letter'">215.9</xsl:when>
|
586
|
+
<xsl:when test="$papersize = 'a4'">210</xsl:when>
|
587
|
+
</xsl:choose>
|
588
|
+
</xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
|
589
|
+
<xsl:choose>
|
590
|
+
<xsl:when test="$papersize = 'letter'">279.4</xsl:when>
|
591
|
+
<xsl:when test="$papersize = 'a4'">297</xsl:when>
|
592
|
+
</xsl:choose>
|
593
|
+
</xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
|
594
|
+
<xsl:choose>
|
595
|
+
<xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
|
596
|
+
<xsl:otherwise>
|
597
|
+
210
|
598
|
+
</xsl:otherwise>
|
599
|
+
</xsl:choose>
|
573
600
|
</xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
|
574
|
-
|
601
|
+
<xsl:choose>
|
602
|
+
<xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
|
603
|
+
<xsl:otherwise>
|
604
|
+
297
|
605
|
+
</xsl:otherwise>
|
606
|
+
</xsl:choose>
|
575
607
|
</xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
|
576
608
|
19
|
577
609
|
</xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
|
@@ -581,20 +613,7 @@
|
|
581
613
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
582
614
|
20.3
|
583
615
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
584
|
-
|
585
|
-
<title-edition lang="en">
|
586
|
-
|
587
|
-
<xsl:text>Edition </xsl:text>
|
588
|
-
|
589
|
-
</title-edition>
|
590
|
-
|
591
|
-
<title-edition lang="fr">
|
592
|
-
<xsl:text>Édition </xsl:text>
|
593
|
-
</title-edition>
|
594
616
|
|
595
|
-
<title-edition lang="ru">
|
596
|
-
<xsl:text>Издание </xsl:text>
|
597
|
-
</title-edition>
|
598
617
|
|
599
618
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
600
619
|
<title-toc lang="en">
|
@@ -675,7 +694,7 @@
|
|
675
694
|
</xsl:variable><xsl:variable name="bibdata">
|
676
695
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
677
696
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
678
|
-
</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">
|
697
|
+
</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">
|
679
698
|
<xsl:param name="name"/>
|
680
699
|
<xsl:param name="lang"/>
|
681
700
|
<xsl:variable name="lang_">
|
@@ -723,7 +742,7 @@
|
|
723
742
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
724
743
|
|
725
744
|
<xsl:variable name="additional_fonts_">
|
726
|
-
<xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
745
|
+
<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']">
|
727
746
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
728
747
|
</xsl:for-each>
|
729
748
|
</xsl:variable>
|
@@ -798,7 +817,6 @@
|
|
798
817
|
|
799
818
|
|
800
819
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
801
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
802
820
|
|
803
821
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
804
822
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -885,6 +903,7 @@
|
|
885
903
|
|
886
904
|
|
887
905
|
|
906
|
+
|
888
907
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
889
908
|
|
890
909
|
|
@@ -1036,6 +1055,7 @@
|
|
1036
1055
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1037
1056
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1038
1057
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1058
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1039
1059
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1040
1060
|
|
1041
1061
|
|
@@ -1054,6 +1074,7 @@
|
|
1054
1074
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1055
1075
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1056
1076
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1077
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1057
1078
|
|
1058
1079
|
|
1059
1080
|
|
@@ -1138,7 +1159,8 @@
|
|
1138
1159
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
1139
1160
|
|
1140
1161
|
|
1141
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
1162
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
1163
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
1142
1164
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
1143
1165
|
|
1144
1166
|
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
@@ -1152,6 +1174,27 @@
|
|
1152
1174
|
|
1153
1175
|
|
1154
1176
|
|
1177
|
+
</xsl:attribute-set><xsl:attribute-set name="dl-name-style">
|
1178
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
1179
|
+
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
1180
|
+
|
1181
|
+
|
1182
|
+
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1183
|
+
|
1184
|
+
|
1185
|
+
|
1186
|
+
|
1187
|
+
|
1188
|
+
|
1189
|
+
|
1190
|
+
|
1191
|
+
|
1192
|
+
|
1193
|
+
|
1194
|
+
|
1195
|
+
|
1196
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
1197
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
1155
1198
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
1156
1199
|
|
1157
1200
|
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
@@ -1468,6 +1511,24 @@
|
|
1468
1511
|
|
1469
1512
|
|
1470
1513
|
|
1514
|
+
</xsl:attribute-set><xsl:attribute-set name="list-name-style">
|
1515
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
1516
|
+
|
1517
|
+
|
1518
|
+
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1519
|
+
|
1520
|
+
|
1521
|
+
|
1522
|
+
|
1523
|
+
|
1524
|
+
|
1525
|
+
|
1526
|
+
|
1527
|
+
|
1528
|
+
|
1529
|
+
|
1530
|
+
|
1531
|
+
|
1471
1532
|
</xsl:attribute-set><xsl:attribute-set name="list-item-style">
|
1472
1533
|
|
1473
1534
|
|
@@ -1852,13 +1913,13 @@
|
|
1852
1913
|
|
1853
1914
|
</xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
|
1854
1915
|
<xsl:variable name="nodes_preface_">
|
1855
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
1916
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
1856
1917
|
<node id="{@id}"/>
|
1857
1918
|
</xsl:for-each>
|
1858
1919
|
</xsl:variable>
|
1859
1920
|
<xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
|
1860
1921
|
|
1861
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
1922
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
1862
1923
|
<xsl:sort select="@displayorder" data-type="number"/>
|
1863
1924
|
|
1864
1925
|
<!-- process Section's title -->
|
@@ -1924,7 +1985,7 @@
|
|
1924
1985
|
</xsl:for-each>
|
1925
1986
|
</figures>
|
1926
1987
|
</xsl:template><xsl:template name="processPrefaceSectionsDefault">
|
1927
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
1988
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
1928
1989
|
<xsl:sort select="@displayorder" data-type="number"/>
|
1929
1990
|
<xsl:apply-templates select="."/>
|
1930
1991
|
</xsl:for-each>
|
@@ -1944,22 +2005,32 @@
|
|
1944
2005
|
<xsl:sort select="@displayorder" data-type="number"/>
|
1945
2006
|
<xsl:apply-templates select="."/>
|
1946
2007
|
</xsl:for-each>
|
1947
|
-
</xsl:template><xsl:variable name="
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
2008
|
+
</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">
|
2009
|
+
|
2010
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
2011
|
+
<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))"/>
|
2012
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2013
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
2014
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
2015
|
+
<xsl:with-param name="text" select="$text"/>
|
2016
|
+
</xsl:call-template>
|
2017
|
+
|
2018
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
2019
|
+
<xsl:param name="tag_open"/>
|
2020
|
+
<xsl:param name="tag_close"/>
|
1954
2021
|
<xsl:param name="text"/>
|
1955
2022
|
<xsl:choose>
|
1956
2023
|
<xsl:when test="contains($text, $tag_open)">
|
1957
2024
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
1958
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
2025
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
1959
2026
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
1960
|
-
<
|
1961
|
-
|
1962
|
-
|
2027
|
+
<fo:inline keep-together.within-line="always">
|
2028
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
2029
|
+
</fo:inline>
|
2030
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
2031
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2032
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
2033
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
1963
2034
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
1964
2035
|
</xsl:call-template>
|
1965
2036
|
</xsl:when>
|
@@ -1967,6 +2038,39 @@
|
|
1967
2038
|
</xsl:choose>
|
1968
2039
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
1969
2040
|
<xsl:value-of select="$linebreak"/>
|
2041
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
2042
|
+
<xsl:param name="split_keep-within-line"/>
|
2043
|
+
|
2044
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
2045
|
+
<xsl:choose>
|
2046
|
+
|
2047
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
2048
|
+
<xsl:variable name="sep">_</xsl:variable>
|
2049
|
+
<xsl:variable name="items">
|
2050
|
+
<xsl:call-template name="split">
|
2051
|
+
<xsl:with-param name="pText" select="."/>
|
2052
|
+
<xsl:with-param name="sep" select="$sep"/>
|
2053
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
2054
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
2055
|
+
</xsl:call-template>
|
2056
|
+
</xsl:variable>
|
2057
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
2058
|
+
<xsl:choose>
|
2059
|
+
<xsl:when test=". = $sep">
|
2060
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
2061
|
+
</xsl:when>
|
2062
|
+
<xsl:otherwise>
|
2063
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2064
|
+
</xsl:otherwise>
|
2065
|
+
</xsl:choose>
|
2066
|
+
</xsl:for-each>
|
2067
|
+
</xsl:when>
|
2068
|
+
|
2069
|
+
<xsl:otherwise>
|
2070
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2071
|
+
</xsl:otherwise>
|
2072
|
+
|
2073
|
+
</xsl:choose>
|
1970
2074
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
1971
2075
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
1972
2076
|
<xsl:apply-templates/>
|
@@ -2032,8 +2136,23 @@
|
|
2032
2136
|
</xsl:call-template>
|
2033
2137
|
|
2034
2138
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
2035
|
-
|
2036
|
-
|
2139
|
+
<xsl:choose>
|
2140
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
2141
|
+
<xsl:value-of select="."/>
|
2142
|
+
</xsl:when>
|
2143
|
+
<xsl:otherwise>
|
2144
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
2145
|
+
</xsl:otherwise>
|
2146
|
+
</xsl:choose>
|
2147
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
2148
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
2149
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
2150
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
2151
|
+
<xsl:choose>
|
2152
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
2153
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
2154
|
+
</xsl:choose>
|
2155
|
+
</xsl:for-each>
|
2037
2156
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
2038
2157
|
|
2039
2158
|
<xsl:variable name="table-preamble">
|
@@ -2043,9 +2162,14 @@
|
|
2043
2162
|
|
2044
2163
|
<xsl:variable name="table">
|
2045
2164
|
|
2046
|
-
<xsl:variable name="simple-table">
|
2047
|
-
<xsl:call-template name="getSimpleTable"
|
2165
|
+
<xsl:variable name="simple-table">
|
2166
|
+
<xsl:call-template name="getSimpleTable">
|
2167
|
+
<xsl:with-param name="id" select="@id"/>
|
2168
|
+
</xsl:call-template>
|
2048
2169
|
</xsl:variable>
|
2170
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
2171
|
+
|
2172
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
2049
2173
|
|
2050
2174
|
|
2051
2175
|
<!-- Display table's name before table as standalone block -->
|
@@ -2068,7 +2192,23 @@
|
|
2068
2192
|
</xsl:call-template>
|
2069
2193
|
</xsl:if>
|
2070
2194
|
</xsl:variable>
|
2071
|
-
<!--
|
2195
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
2196
|
+
|
2197
|
+
<!-- DEBUG -->
|
2198
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2199
|
+
<fo:block font-size="60%">
|
2200
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
2201
|
+
</fo:block>
|
2202
|
+
</xsl:if>
|
2203
|
+
|
2204
|
+
|
2205
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
2206
|
+
|
2207
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
2208
|
+
DEBUG
|
2209
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
2210
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
2211
|
+
|
2072
2212
|
|
2073
2213
|
|
2074
2214
|
<xsl:variable name="margin-side">
|
@@ -2135,9 +2275,17 @@
|
|
2135
2275
|
</xsl:element>
|
2136
2276
|
</xsl:variable>
|
2137
2277
|
|
2278
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2279
|
+
<!-- to determine start of table -->
|
2280
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
2281
|
+
</xsl:if>
|
2138
2282
|
|
2139
2283
|
<fo:table id="{@id}">
|
2140
2284
|
|
2285
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2286
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
2287
|
+
</xsl:if>
|
2288
|
+
|
2141
2289
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
2142
2290
|
<xsl:attribute name="{local-name()}">
|
2143
2291
|
<xsl:value-of select="."/>
|
@@ -2151,31 +2299,47 @@
|
|
2151
2299
|
|
2152
2300
|
|
2153
2301
|
<xsl:choose>
|
2154
|
-
<xsl:when test="
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2302
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
2303
|
+
<!-- generate IF for table widths -->
|
2304
|
+
<!-- example:
|
2305
|
+
<tr>
|
2306
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
2307
|
+
<p>Symbol</p>
|
2308
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
2309
|
+
</td>
|
2310
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
2311
|
+
<p>Description</p>
|
2312
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
2313
|
+
</td>
|
2314
|
+
</tr>
|
2315
|
+
-->
|
2316
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
2317
|
+
|
2158
2318
|
</xsl:when>
|
2159
2319
|
<xsl:otherwise>
|
2160
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
2161
|
-
<xsl:choose>
|
2162
|
-
<xsl:when test=". = 1 or . = 0">
|
2163
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
2164
|
-
</xsl:when>
|
2165
|
-
<xsl:otherwise>
|
2166
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2167
|
-
</xsl:otherwise>
|
2168
|
-
</xsl:choose>
|
2169
|
-
</xsl:for-each>
|
2170
|
-
</xsl:otherwise>
|
2171
|
-
</xsl:choose>
|
2172
2320
|
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2321
|
+
<xsl:choose>
|
2322
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
2323
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
2324
|
+
<fo:table-column column-width="{@width}"/>
|
2325
|
+
</xsl:for-each>
|
2326
|
+
</xsl:when>
|
2327
|
+
<xsl:otherwise>
|
2328
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2329
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2330
|
+
</xsl:call-template>
|
2331
|
+
</xsl:otherwise>
|
2332
|
+
</xsl:choose>
|
2333
|
+
|
2334
|
+
<xsl:choose>
|
2335
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
2336
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
2337
|
+
</xsl:when>
|
2338
|
+
<xsl:otherwise>
|
2339
|
+
<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 -->
|
2340
|
+
</xsl:otherwise>
|
2341
|
+
</xsl:choose>
|
2342
|
+
|
2179
2343
|
</xsl:otherwise>
|
2180
2344
|
</xsl:choose>
|
2181
2345
|
|
@@ -2278,11 +2442,22 @@
|
|
2278
2442
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
2279
2443
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
2280
2444
|
</xsl:template><xsl:template name="calculate-column-widths">
|
2445
|
+
<xsl:param name="table"/>
|
2446
|
+
<xsl:param name="cols-count"/>
|
2447
|
+
|
2448
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2449
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2450
|
+
<xsl:with-param name="table" select="$table"/>
|
2451
|
+
</xsl:call-template>
|
2452
|
+
|
2453
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
2281
2454
|
<xsl:param name="table"/>
|
2282
2455
|
<xsl:param name="cols-count"/>
|
2283
2456
|
<xsl:param name="curr-col" select="1"/>
|
2284
2457
|
<xsl:param name="width" select="0"/>
|
2285
2458
|
|
2459
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
2460
|
+
|
2286
2461
|
<xsl:if test="$curr-col <= $cols-count">
|
2287
2462
|
<xsl:variable name="widths">
|
2288
2463
|
<xsl:choose>
|
@@ -2320,16 +2495,22 @@
|
|
2320
2495
|
</xsl:for-each>
|
2321
2496
|
</xsl:when>
|
2322
2497
|
<xsl:otherwise>
|
2323
|
-
<xsl:
|
2498
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
2499
|
+
|
2500
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
2501
|
+
-->
|
2502
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
2324
2503
|
<xsl:variable name="td_text">
|
2325
2504
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
2326
2505
|
</xsl:variable>
|
2506
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
2327
2507
|
<xsl:variable name="words">
|
2328
2508
|
<xsl:variable name="string_with_added_zerospaces">
|
2329
2509
|
<xsl:call-template name="add-zero-spaces-java">
|
2330
2510
|
<xsl:with-param name="text" select="$td_text"/>
|
2331
2511
|
</xsl:call-template>
|
2332
2512
|
</xsl:variable>
|
2513
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
2333
2514
|
<xsl:call-template name="tokenize">
|
2334
2515
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
2335
2516
|
<!-- 2009 thinspace -->
|
@@ -2337,11 +2518,13 @@
|
|
2337
2518
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2338
2519
|
</xsl:call-template>
|
2339
2520
|
</xsl:variable>
|
2521
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
2340
2522
|
<xsl:variable name="max_length">
|
2341
2523
|
<xsl:call-template name="max_length">
|
2342
2524
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2343
2525
|
</xsl:call-template>
|
2344
2526
|
</xsl:variable>
|
2527
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
2345
2528
|
<width>
|
2346
2529
|
<xsl:variable name="divider">
|
2347
2530
|
<xsl:choose>
|
@@ -2360,6 +2543,8 @@
|
|
2360
2543
|
</xsl:choose>
|
2361
2544
|
</xsl:variable>
|
2362
2545
|
|
2546
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
2547
|
+
|
2363
2548
|
<column>
|
2364
2549
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
2365
2550
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -2368,29 +2553,271 @@
|
|
2368
2553
|
</xsl:if>
|
2369
2554
|
</xsl:for-each>
|
2370
2555
|
</column>
|
2371
|
-
<xsl:call-template name="calculate-column-widths">
|
2556
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2372
2557
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2373
2558
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
2374
2559
|
<xsl:with-param name="table" select="$table"/>
|
2375
2560
|
</xsl:call-template>
|
2376
2561
|
</xsl:if>
|
2562
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
2563
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
2564
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
2565
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
2566
|
+
|
2567
|
+
<!-- if all capitals english letters or digits -->
|
2568
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
2569
|
+
<xsl:call-template name="repeat">
|
2570
|
+
<xsl:with-param name="char" select="'X'"/>
|
2571
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
2572
|
+
</xsl:call-template>
|
2573
|
+
</xsl:if>
|
2377
2574
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
2378
2575
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
2379
2576
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
2380
2577
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
2381
2578
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
2382
2579
|
<xsl:value-of select="@target"/>
|
2383
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
2384
|
-
<xsl:
|
2385
|
-
<xsl:
|
2386
|
-
<xsl:
|
2387
|
-
<xsl:
|
2388
|
-
|
2580
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
2581
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
2582
|
+
<xsl:variable name="mathml_">
|
2583
|
+
<xsl:for-each select="*">
|
2584
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
2585
|
+
<xsl:copy-of select="."/>
|
2586
|
+
</xsl:if>
|
2587
|
+
</xsl:for-each>
|
2588
|
+
</xsl:variable>
|
2589
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
2590
|
+
|
2591
|
+
<xsl:variable name="math_text">
|
2592
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
2593
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
2594
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
2595
|
+
</xsl:variable>
|
2596
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
2597
|
+
</xsl:if>
|
2598
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
2599
|
+
<xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
|
2600
|
+
|
2601
|
+
<!-- via intermediate format -->
|
2602
|
+
|
2603
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
2604
|
+
|
2605
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
2606
|
+
|
2607
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
2608
|
+
|
2609
|
+
<!-- get current table id -->
|
2610
|
+
<xsl:variable name="table_id" select="@id"/>
|
2611
|
+
<!-- find table by id in the file 'table_widths' -->
|
2612
|
+
<!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
2613
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
|
2614
|
+
|
2615
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
2616
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
2617
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
2618
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
2619
|
+
|
2620
|
+
<xsl:variable name="table_with_cell_widths_">
|
2621
|
+
<xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
|
2622
|
+
</xsl:variable>
|
2623
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
2624
|
+
|
2625
|
+
<!-- <xsl:if test="$table_if_debug = 'true'">
|
2626
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
2627
|
+
</xsl:if> -->
|
2628
|
+
|
2629
|
+
|
2630
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
2631
|
+
|
2632
|
+
<xsl:variable name="column_widths_">
|
2633
|
+
<!-- iteration of columns -->
|
2634
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
2635
|
+
<xsl:variable name="pos" select="position()"/>
|
2636
|
+
<column>
|
2637
|
+
<xsl:attribute name="width_max">
|
2638
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
2639
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2640
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2641
|
+
</xsl:for-each>
|
2642
|
+
</xsl:attribute>
|
2643
|
+
<xsl:attribute name="width_min">
|
2644
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
2645
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2646
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2647
|
+
</xsl:for-each>
|
2648
|
+
</xsl:attribute>
|
2649
|
+
</column>
|
2389
2650
|
</xsl:for-each>
|
2390
2651
|
</xsl:variable>
|
2652
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
2653
|
+
|
2654
|
+
<!-- <column_widths>
|
2655
|
+
<xsl:copy-of select="$column_widths"/>
|
2656
|
+
</column_widths> -->
|
2657
|
+
|
2658
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
2659
|
+
<xsl:variable name="table_widths_">
|
2660
|
+
<table>
|
2661
|
+
<xsl:attribute name="width_max">
|
2662
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
2663
|
+
</xsl:attribute>
|
2664
|
+
<xsl:attribute name="width_min">
|
2665
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
2666
|
+
</xsl:attribute>
|
2667
|
+
</table>
|
2668
|
+
</xsl:variable>
|
2669
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
2670
|
+
|
2671
|
+
<xsl:variable name="page_width">
|
2672
|
+
<xsl:choose>
|
2673
|
+
<xsl:when test="$parent_table_page-width != ''">
|
2674
|
+
<xsl:value-of select="$parent_table_page-width"/>
|
2675
|
+
</xsl:when>
|
2676
|
+
<xsl:otherwise>
|
2677
|
+
<xsl:value-of select="@page-width"/>
|
2678
|
+
</xsl:otherwise>
|
2679
|
+
</xsl:choose>
|
2680
|
+
</xsl:variable>
|
2681
|
+
|
2682
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2683
|
+
<table_width>
|
2684
|
+
<xsl:copy-of select="$table_widths"/>
|
2685
|
+
</table_width>
|
2686
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
2687
|
+
</xsl:if>
|
2688
|
+
|
2689
|
+
|
2690
|
+
<!-- There are three cases: -->
|
2691
|
+
<xsl:choose>
|
2692
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
2693
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
2694
|
+
<!-- call old algorithm -->
|
2695
|
+
<case1/>
|
2696
|
+
<!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
2697
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2698
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2699
|
+
<xsl:with-param name="table" select="$table"/>
|
2700
|
+
</xsl:call-template> -->
|
2701
|
+
</xsl:when>
|
2702
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
2703
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
2704
|
+
<case2/>
|
2705
|
+
<autolayout/>
|
2706
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
2707
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
2708
|
+
</xsl:for-each>
|
2709
|
+
</xsl:when>
|
2710
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
2711
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
2712
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
2713
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
2714
|
+
Now set the column's width to the minimum width plus d times W over D.
|
2715
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
2716
|
+
<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)">
|
2717
|
+
<!-- difference between the available space and the minimum table width -->
|
2718
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
2719
|
+
<W><xsl:value-of select="$W"/></W>
|
2720
|
+
<!-- difference between maximum and minimum width of the table -->
|
2721
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
2722
|
+
<D><xsl:value-of select="$D"/></D>
|
2723
|
+
<case3/>
|
2724
|
+
<autolayout/>
|
2725
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
2726
|
+
<split_keep-within-line>true</split_keep-within-line>
|
2727
|
+
</xsl:if>
|
2728
|
+
<xsl:for-each select="$column_widths/column">
|
2729
|
+
<!-- difference between maximum and minimum width of that column. -->
|
2730
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
2731
|
+
<d><xsl:value-of select="$d"/></d>
|
2732
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
2733
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
2734
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
2735
|
+
<column divider="100">
|
2736
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
2737
|
+
</column>
|
2738
|
+
</xsl:for-each>
|
2739
|
+
|
2740
|
+
</xsl:when>
|
2741
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
2742
|
+
</xsl:choose>
|
2743
|
+
|
2744
|
+
</xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
|
2745
|
+
|
2746
|
+
<!-- if nested 'dl' or 'table' -->
|
2747
|
+
<xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
|
2748
|
+
<parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
|
2749
|
+
|
2750
|
+
<parent_element><xsl:value-of select="local-name(..)"/></parent_element>
|
2751
|
+
|
2752
|
+
<xsl:variable name="parent_table_page-width_">
|
2753
|
+
<xsl:if test="$parent_table_id != ''">
|
2754
|
+
<!-- determine column number in the parent table -->
|
2755
|
+
<xsl:variable name="parent_table_column_number">
|
2756
|
+
<xsl:choose>
|
2757
|
+
<xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
|
2758
|
+
<xsl:otherwise> <!-- parent is table -->
|
2759
|
+
<xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
|
2760
|
+
</xsl:otherwise>
|
2761
|
+
</xsl:choose>
|
2762
|
+
</xsl:variable>
|
2763
|
+
<!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
|
2764
|
+
<xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
|
2765
|
+
</xsl:if>
|
2766
|
+
</xsl:variable>
|
2767
|
+
<xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
|
2768
|
+
|
2769
|
+
<!-- get current table id -->
|
2770
|
+
<xsl:variable name="table_id" select="@id"/>
|
2771
|
+
|
2772
|
+
<xsl:choose>
|
2773
|
+
<xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
|
2774
|
+
<!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
|
2775
|
+
<xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
|
2776
|
+
</xsl:when>
|
2777
|
+
<xsl:otherwise>
|
2778
|
+
<!-- recalculate columns width based on parent table width -->
|
2779
|
+
<xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
|
2780
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm">
|
2781
|
+
<xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
|
2782
|
+
</xsl:call-template>
|
2783
|
+
</xsl:for-each>
|
2784
|
+
</xsl:otherwise>
|
2785
|
+
</xsl:choose>
|
2391
2786
|
|
2392
|
-
|
2393
|
-
<xsl:
|
2787
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
2788
|
+
<xsl:copy>
|
2789
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
2790
|
+
</xsl:copy>
|
2791
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
2792
|
+
<xsl:copy>
|
2793
|
+
<xsl:copy-of select="@*"/>
|
2794
|
+
|
2795
|
+
<!-- The maximum width is given by the widest line. -->
|
2796
|
+
<xsl:attribute name="width_max">
|
2797
|
+
<xsl:for-each select="p_len">
|
2798
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2799
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2800
|
+
</xsl:for-each>
|
2801
|
+
</xsl:attribute>
|
2802
|
+
|
2803
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
2804
|
+
<xsl:variable name="width_min">
|
2805
|
+
<xsl:for-each select="word_len">
|
2806
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2807
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2808
|
+
</xsl:for-each>
|
2809
|
+
</xsl:variable>
|
2810
|
+
<xsl:attribute name="width_min">
|
2811
|
+
<xsl:value-of select="$width_min"/>
|
2812
|
+
</xsl:attribute>
|
2813
|
+
|
2814
|
+
<xsl:if test="$width_min = 0">
|
2815
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
2816
|
+
</xsl:if>
|
2817
|
+
|
2818
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
2819
|
+
|
2820
|
+
</xsl:copy>
|
2394
2821
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
2395
2822
|
<xsl:param name="cols-count"/>
|
2396
2823
|
<fo:table-header>
|
@@ -2475,16 +2902,10 @@
|
|
2475
2902
|
</xsl:for-each>
|
2476
2903
|
</xsl:when>
|
2477
2904
|
<xsl:otherwise>
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
</xsl:when>
|
2483
|
-
<xsl:otherwise>
|
2484
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2485
|
-
</xsl:otherwise>
|
2486
|
-
</xsl:choose>
|
2487
|
-
</xsl:for-each>
|
2905
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
2906
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2907
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2908
|
+
</xsl:call-template>
|
2488
2909
|
</xsl:otherwise>
|
2489
2910
|
</xsl:choose>
|
2490
2911
|
|
@@ -2561,25 +2982,71 @@
|
|
2561
2982
|
|
2562
2983
|
</fo:table-body>
|
2563
2984
|
|
2564
|
-
</xsl:template><xsl:template match="
|
2565
|
-
<
|
2985
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
2986
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
2987
|
+
<xsl:apply-templates mode="process_table-if">
|
2988
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
2989
|
+
</xsl:apply-templates>
|
2990
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
2991
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
2566
2992
|
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2993
|
+
<fo:table-body>
|
2994
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
2995
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
2570
2996
|
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2997
|
+
<!-- iteration for each tr/td -->
|
2998
|
+
|
2999
|
+
<xsl:choose>
|
3000
|
+
<xsl:when test="$table_or_dl = 'table'">
|
3001
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
3002
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3003
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
3004
|
+
<xsl:call-template name="td"/>
|
3005
|
+
</fo:table-row>
|
3006
|
+
</xsl:for-each>
|
3007
|
+
</xsl:when>
|
3008
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
3009
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
3010
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
3011
|
+
|
3012
|
+
<xsl:for-each select="*">
|
3013
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
3014
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3015
|
+
<xsl:choose>
|
3016
|
+
<xsl:when test="$is_dt">
|
3017
|
+
<xsl:call-template name="insert_dt_cell"/>
|
3018
|
+
</xsl:when>
|
3019
|
+
<xsl:otherwise>
|
3020
|
+
<xsl:call-template name="insert_dd_cell"/>
|
3021
|
+
</xsl:otherwise>
|
3022
|
+
</xsl:choose>
|
3023
|
+
</fo:table-row>
|
3024
|
+
</xsl:for-each>
|
3025
|
+
</xsl:for-each>
|
3026
|
+
</xsl:otherwise>
|
3027
|
+
</xsl:choose>
|
3028
|
+
|
3029
|
+
</xsl:for-each>
|
3030
|
+
</fo:table-body>
|
3031
|
+
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
3032
|
+
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
3033
|
+
|
3034
|
+
|
3035
|
+
|
3036
|
+
|
3037
|
+
|
3038
|
+
|
3039
|
+
|
3040
|
+
<xsl:call-template name="setTableRowAttributes"/>
|
3041
|
+
|
3042
|
+
<xsl:apply-templates/>
|
3043
|
+
</fo:table-row>
|
3044
|
+
</xsl:template><xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
3045
|
+
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
3046
|
+
|
3047
|
+
<xsl:call-template name="setTableRowAttributes"/>
|
3048
|
+
<xsl:apply-templates/>
|
3049
|
+
</fo:table-row>
|
2583
3050
|
</xsl:template><xsl:template match="*[local-name()='tr']">
|
2584
3051
|
<fo:table-row xsl:use-attribute-sets="table-body-row-style">
|
2585
3052
|
|
@@ -2647,7 +3114,7 @@
|
|
2647
3114
|
</xsl:choose>
|
2648
3115
|
</xsl:attribute>
|
2649
3116
|
</xsl:if>
|
2650
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
3117
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
2651
3118
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
2652
3119
|
<xsl:call-template name="setTextAlignment">
|
2653
3120
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -2681,11 +3148,24 @@
|
|
2681
3148
|
|
2682
3149
|
<xsl:call-template name="setTableCellAttributes"/>
|
2683
3150
|
|
3151
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3152
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
3153
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3154
|
+
</xsl:if>
|
3155
|
+
|
2684
3156
|
<fo:block>
|
2685
3157
|
|
3158
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3159
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3160
|
+
</xsl:if>
|
3161
|
+
|
3162
|
+
|
2686
3163
|
|
2687
3164
|
|
2688
3165
|
<xsl:apply-templates/>
|
3166
|
+
|
3167
|
+
<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"/> -->
|
3168
|
+
|
2689
3169
|
</fo:block>
|
2690
3170
|
</fo:table-cell>
|
2691
3171
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -2882,9 +3362,9 @@
|
|
2882
3362
|
<!-- current hierarchy is 'figure' element -->
|
2883
3363
|
<xsl:variable name="following_dl_colwidths">
|
2884
3364
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
2885
|
-
<xsl:variable name="
|
2886
|
-
<xsl:variable name="doc_ns">
|
2887
|
-
|
3365
|
+
<xsl:variable name="simple-table">
|
3366
|
+
<!-- <xsl:variable name="doc_ns">
|
3367
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
2888
3368
|
</xsl:variable>
|
2889
3369
|
<xsl:variable name="ns">
|
2890
3370
|
<xsl:choose>
|
@@ -2895,7 +3375,7 @@
|
|
2895
3375
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
2896
3376
|
</xsl:otherwise>
|
2897
3377
|
</xsl:choose>
|
2898
|
-
</xsl:variable>
|
3378
|
+
</xsl:variable> -->
|
2899
3379
|
|
2900
3380
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
2901
3381
|
<tbody>
|
@@ -2906,7 +3386,7 @@
|
|
2906
3386
|
|
2907
3387
|
<xsl:call-template name="calculate-column-widths">
|
2908
3388
|
<xsl:with-param name="cols-count" select="2"/>
|
2909
|
-
<xsl:with-param name="table" select="$
|
3389
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
2910
3390
|
</xsl:call-template>
|
2911
3391
|
|
2912
3392
|
</xsl:if>
|
@@ -3025,8 +3505,10 @@
|
|
3025
3505
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
3026
3506
|
</xsl:variable>
|
3027
3507
|
|
3508
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
3509
|
+
|
3028
3510
|
<xsl:choose>
|
3029
|
-
<xsl:when test="$
|
3511
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
3030
3512
|
|
3031
3513
|
<fo:block margin-bottom="12pt" text-align="left">
|
3032
3514
|
|
@@ -3041,7 +3523,7 @@
|
|
3041
3523
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
3042
3524
|
</fo:block>
|
3043
3525
|
|
3044
|
-
</xsl:when>
|
3526
|
+
</xsl:when> <!-- END: only one component -->
|
3045
3527
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
3046
3528
|
<fo:block margin-bottom="12pt" text-align="left">
|
3047
3529
|
|
@@ -3055,8 +3537,8 @@
|
|
3055
3537
|
</xsl:variable>
|
3056
3538
|
<xsl:value-of select="$title-where"/>
|
3057
3539
|
</fo:block>
|
3058
|
-
</xsl:when>
|
3059
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
3540
|
+
</xsl:when> <!-- END: a few components -->
|
3541
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
3060
3542
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
3061
3543
|
|
3062
3544
|
|
@@ -3069,22 +3551,41 @@
|
|
3069
3551
|
</xsl:variable>
|
3070
3552
|
<xsl:value-of select="$title-key"/>
|
3071
3553
|
</fo:block>
|
3072
|
-
</xsl:when>
|
3554
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
3073
3555
|
</xsl:choose>
|
3074
3556
|
|
3075
3557
|
<!-- a few components -->
|
3076
|
-
<xsl:if test="
|
3558
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
3077
3559
|
<fo:block>
|
3078
3560
|
|
3079
3561
|
|
3080
3562
|
|
3081
3563
|
|
3564
|
+
|
3565
|
+
<xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
|
3566
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3567
|
+
</xsl:if>
|
3568
|
+
|
3082
3569
|
<fo:block>
|
3083
3570
|
|
3084
3571
|
|
3085
3572
|
|
3086
3573
|
|
3574
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
3575
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
3576
|
+
</xsl:apply-templates>
|
3577
|
+
|
3578
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3579
|
+
<!-- to determine start of table -->
|
3580
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3581
|
+
</xsl:if>
|
3582
|
+
|
3087
3583
|
<fo:table width="95%" table-layout="fixed">
|
3584
|
+
|
3585
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3586
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3587
|
+
</xsl:if>
|
3588
|
+
|
3088
3589
|
|
3089
3590
|
<xsl:choose>
|
3090
3591
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -3093,61 +3594,178 @@
|
|
3093
3594
|
|
3094
3595
|
</xsl:when>
|
3095
3596
|
</xsl:choose>
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3597
|
+
|
3598
|
+
|
3599
|
+
|
3600
|
+
<xsl:choose>
|
3601
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3602
|
+
<!-- generate IF for table widths -->
|
3603
|
+
<!-- example:
|
3604
|
+
<tr>
|
3605
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3606
|
+
<p>Symbol</p>
|
3607
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3608
|
+
</td>
|
3609
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3610
|
+
<p>Description</p>
|
3611
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3612
|
+
</td>
|
3613
|
+
</tr>
|
3614
|
+
-->
|
3099
3615
|
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
<xsl:
|
3104
|
-
<
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3616
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
3617
|
+
<xsl:variable name="simple-table">
|
3618
|
+
|
3619
|
+
<xsl:variable name="dl_table">
|
3620
|
+
<tbody>
|
3621
|
+
<xsl:apply-templates mode="dl_if">
|
3622
|
+
<xsl:with-param name="id" select="@id"/>
|
3623
|
+
</xsl:apply-templates>
|
3624
|
+
</tbody>
|
3625
|
+
</xsl:variable>
|
3626
|
+
|
3627
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
3628
|
+
|
3629
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
3630
|
+
<xsl:variable name="table_without_br">
|
3631
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
3632
|
+
</xsl:variable>
|
3633
|
+
|
3634
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
3635
|
+
|
3636
|
+
<!-- Step: add id to each cell -->
|
3637
|
+
<!-- add <word>...</word> for each word, image, math -->
|
3638
|
+
<xsl:variable name="simple-table-id">
|
3639
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
3640
|
+
<xsl:with-param name="id" select="@id"/>
|
3641
|
+
</xsl:apply-templates>
|
3642
|
+
</xsl:variable>
|
3643
|
+
|
3644
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
3645
|
+
|
3646
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
3647
|
+
|
3648
|
+
</xsl:variable>
|
3649
|
+
|
3650
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
3651
|
+
|
3652
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
3653
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
3654
|
+
</xsl:apply-templates>
|
3655
|
+
|
3656
|
+
</xsl:when>
|
3657
|
+
<xsl:otherwise>
|
3658
|
+
|
3659
|
+
<xsl:variable name="simple-table">
|
3660
|
+
|
3661
|
+
<xsl:variable name="dl_table">
|
3662
|
+
<tbody>
|
3663
|
+
<xsl:apply-templates mode="dl">
|
3664
|
+
<xsl:with-param name="id" select="@id"/>
|
3665
|
+
</xsl:apply-templates>
|
3666
|
+
</tbody>
|
3667
|
+
</xsl:variable>
|
3668
|
+
|
3669
|
+
<xsl:copy-of select="$dl_table"/>
|
3670
|
+
</xsl:variable>
|
3671
|
+
|
3672
|
+
<xsl:variable name="colwidths">
|
3673
|
+
<xsl:call-template name="calculate-column-widths">
|
3674
|
+
<xsl:with-param name="cols-count" select="2"/>
|
3675
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3676
|
+
</xsl:call-template>
|
3677
|
+
</xsl:variable>
|
3678
|
+
|
3679
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3680
|
+
DEBUG
|
3681
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3682
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3683
|
+
|
3684
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3685
|
+
|
3686
|
+
<xsl:variable name="maxlength_dt">
|
3687
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
3688
|
+
</xsl:variable>
|
3689
|
+
|
3690
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
3691
|
+
false
|
3692
|
+
</xsl:variable>
|
3693
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
3694
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
3695
|
+
|
3696
|
+
|
3697
|
+
<xsl:call-template name="setColumnWidth_dl">
|
3698
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3699
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
3700
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
3701
|
+
</xsl:call-template>
|
3702
|
+
|
3703
|
+
<fo:table-body>
|
3704
|
+
|
3705
|
+
<!-- DEBUG -->
|
3706
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3707
|
+
<fo:table-row>
|
3708
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
3709
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3710
|
+
</fo:table-cell>
|
3711
|
+
</fo:table-row>
|
3712
|
+
</xsl:if>
|
3713
|
+
|
3714
|
+
<xsl:apply-templates>
|
3715
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
3716
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
3717
|
+
</xsl:apply-templates>
|
3718
|
+
|
3719
|
+
</fo:table-body>
|
3720
|
+
</xsl:otherwise>
|
3721
|
+
</xsl:choose>
|
3135
3722
|
</fo:table>
|
3136
3723
|
</fo:block>
|
3137
3724
|
</fo:block>
|
3138
|
-
</xsl:if>
|
3725
|
+
</xsl:if> <!-- END: a few components -->
|
3139
3726
|
</fo:block-container>
|
3140
3727
|
</fo:block-container>
|
3728
|
+
|
3729
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
|
3730
|
+
<xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
|
3731
|
+
</xsl:if>
|
3732
|
+
|
3733
|
+
</xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
3734
|
+
<xsl:param name="process">false</xsl:param>
|
3735
|
+
<xsl:if test="$process = 'true'">
|
3736
|
+
<fo:block xsl:use-attribute-sets="dl-name-style">
|
3737
|
+
<xsl:apply-templates/>
|
3738
|
+
</fo:block>
|
3739
|
+
</xsl:if>
|
3141
3740
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
3142
3741
|
<xsl:param name="colwidths"/>
|
3143
3742
|
<xsl:param name="maxlength_dt"/>
|
3743
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
3744
|
+
|
3745
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
3746
|
+
|
3144
3747
|
<xsl:choose>
|
3748
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
3749
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3750
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3751
|
+
</xsl:call-template>
|
3752
|
+
</xsl:when>
|
3145
3753
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
3146
3754
|
<fo:table-column column-width="50%"/>
|
3147
3755
|
<fo:table-column column-width="50%"/>
|
3148
3756
|
</xsl:when>
|
3149
3757
|
<xsl:otherwise>
|
3150
3758
|
<xsl:choose>
|
3759
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
3760
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3761
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3762
|
+
</xsl:call-template>
|
3763
|
+
</xsl:when>
|
3764
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
3765
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3766
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3767
|
+
</xsl:call-template>
|
3768
|
+
</xsl:when>
|
3151
3769
|
<!-- to set width check most wide chars like `W` -->
|
3152
3770
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
3153
3771
|
<fo:table-column column-width="7%"/>
|
@@ -3178,20 +3796,31 @@
|
|
3178
3796
|
<fo:table-column column-width="60%"/>
|
3179
3797
|
</xsl:when>
|
3180
3798
|
<xsl:otherwise>
|
3181
|
-
<xsl:
|
3182
|
-
<xsl:
|
3183
|
-
|
3184
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3185
|
-
</xsl:when>
|
3186
|
-
<xsl:otherwise>
|
3187
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3188
|
-
</xsl:otherwise>
|
3189
|
-
</xsl:choose>
|
3190
|
-
</xsl:for-each>
|
3799
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3800
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3801
|
+
</xsl:call-template>
|
3191
3802
|
</xsl:otherwise>
|
3192
3803
|
</xsl:choose>
|
3193
3804
|
</xsl:otherwise>
|
3194
3805
|
</xsl:choose>
|
3806
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
3807
|
+
<xsl:param name="colwidths"/>
|
3808
|
+
|
3809
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
3810
|
+
<xsl:choose>
|
3811
|
+
<xsl:when test=". = 1 or . = 0">
|
3812
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
3813
|
+
</xsl:when>
|
3814
|
+
<xsl:otherwise>
|
3815
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
3816
|
+
<xsl:variable name="divider">
|
3817
|
+
<xsl:value-of select="@divider"/>
|
3818
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
3819
|
+
</xsl:variable>
|
3820
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
3821
|
+
</xsl:otherwise>
|
3822
|
+
</xsl:choose>
|
3823
|
+
</xsl:for-each>
|
3195
3824
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
3196
3825
|
<xsl:variable name="lengths">
|
3197
3826
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -3215,7 +3844,6 @@
|
|
3215
3844
|
<xsl:value-of select="$maxLength"/>
|
3216
3845
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
3217
3846
|
<xsl:param name="key_iso"/>
|
3218
|
-
|
3219
3847
|
<!-- <tr>
|
3220
3848
|
<td>NOTE</td>
|
3221
3849
|
<td>
|
@@ -3223,27 +3851,47 @@
|
|
3223
3851
|
</td>
|
3224
3852
|
</tr>
|
3225
3853
|
-->
|
3226
|
-
|
3854
|
+
<!-- OLD Variant -->
|
3855
|
+
<!-- <fo:table-row>
|
3227
3856
|
<fo:table-cell>
|
3228
3857
|
<fo:block margin-top="6pt">
|
3229
3858
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3230
3859
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3231
3860
|
</xsl:if>
|
3232
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
3861
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
3233
3862
|
</fo:block>
|
3234
3863
|
</fo:table-cell>
|
3235
3864
|
<fo:table-cell>
|
3236
3865
|
<fo:block>
|
3237
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
3866
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
3867
|
+
</fo:block>
|
3868
|
+
</fo:table-cell>
|
3869
|
+
</fo:table-row> -->
|
3870
|
+
<!-- <tr>
|
3871
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
3872
|
+
</tr>
|
3873
|
+
-->
|
3874
|
+
<fo:table-row>
|
3875
|
+
<fo:table-cell number-columns-spanned="2">
|
3876
|
+
<fo:block>
|
3877
|
+
<xsl:call-template name="note"/>
|
3238
3878
|
</fo:block>
|
3239
3879
|
</fo:table-cell>
|
3240
3880
|
</fo:table-row>
|
3241
3881
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
3882
|
+
<xsl:param name="id"/>
|
3883
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3242
3884
|
<tr>
|
3243
3885
|
<td>
|
3886
|
+
<xsl:attribute name="id">
|
3887
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
3888
|
+
</xsl:attribute>
|
3244
3889
|
<xsl:apply-templates/>
|
3245
3890
|
</td>
|
3246
3891
|
<td>
|
3892
|
+
<xsl:attribute name="id">
|
3893
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
3894
|
+
</xsl:attribute>
|
3247
3895
|
|
3248
3896
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
3249
3897
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -3254,50 +3902,134 @@
|
|
3254
3902
|
|
3255
3903
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
3256
3904
|
<xsl:param name="key_iso"/>
|
3905
|
+
<xsl:param name="split_keep-within-line"/>
|
3257
3906
|
|
3258
3907
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
3259
|
-
<
|
3908
|
+
<xsl:call-template name="insert_dt_cell">
|
3909
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
3910
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3911
|
+
</xsl:call-template>
|
3912
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
3913
|
+
<xsl:call-template name="insert_dd_cell">
|
3914
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3915
|
+
</xsl:call-template>
|
3916
|
+
</xsl:for-each>
|
3917
|
+
</fo:table-row>
|
3918
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
3919
|
+
<xsl:param name="key_iso"/>
|
3920
|
+
<xsl:param name="split_keep-within-line"/>
|
3921
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
3922
|
+
|
3923
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3924
|
+
<!-- border is mandatory, to calculate real width -->
|
3925
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
3926
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3927
|
+
</xsl:if>
|
3928
|
+
|
3929
|
+
|
3930
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
3931
|
+
<xsl:copy-of select="@id"/>
|
3932
|
+
|
3933
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3934
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3935
|
+
</xsl:if>
|
3936
|
+
|
3937
|
+
|
3938
|
+
|
3939
|
+
<xsl:apply-templates>
|
3940
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3941
|
+
</xsl:apply-templates>
|
3942
|
+
|
3943
|
+
<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"/> -->
|
3944
|
+
|
3945
|
+
</fo:block>
|
3946
|
+
</fo:table-cell>
|
3947
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
3948
|
+
<xsl:param name="split_keep-within-line"/>
|
3949
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
3950
|
+
|
3951
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3952
|
+
<!-- border is mandatory, to calculate real width -->
|
3953
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
3954
|
+
</xsl:if>
|
3955
|
+
|
3956
|
+
<fo:block>
|
3957
|
+
|
3958
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3959
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3960
|
+
</xsl:if>
|
3961
|
+
|
3260
3962
|
|
3261
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
3262
|
-
<xsl:copy-of select="@id"/>
|
3263
|
-
|
3264
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3265
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3266
|
-
</xsl:if>
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
<xsl:apply-templates/>
|
3271
|
-
</fo:block>
|
3272
|
-
</fo:table-cell>
|
3273
|
-
<fo:table-cell>
|
3274
|
-
<fo:block>
|
3275
|
-
|
3276
3963
|
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3964
|
+
<xsl:choose>
|
3965
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3966
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
3967
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
3968
|
+
</xsl:apply-templates>
|
3969
|
+
</xsl:when>
|
3970
|
+
<xsl:otherwise>
|
3971
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
3972
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
3973
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3974
|
+
</xsl:apply-templates>
|
3975
|
+
</xsl:otherwise>
|
3976
|
+
|
3977
|
+
</xsl:choose>
|
3978
|
+
|
3979
|
+
<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"/> -->
|
3980
|
+
|
3981
|
+
</fo:block>
|
3982
|
+
</fo:table-cell>
|
3283
3983
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
3284
3984
|
<xsl:apply-templates/>
|
3285
3985
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
3286
3986
|
<xsl:param name="process">false</xsl:param>
|
3987
|
+
<xsl:param name="split_keep-within-line"/>
|
3287
3988
|
<xsl:if test="$process = 'true'">
|
3288
3989
|
<xsl:apply-templates select="@language"/>
|
3289
|
-
<xsl:apply-templates
|
3990
|
+
<xsl:apply-templates>
|
3991
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
3992
|
+
</xsl:apply-templates>
|
3290
3993
|
</xsl:if>
|
3291
3994
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
3292
3995
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
3293
|
-
</xsl:template><xsl:template match="*[local-name()='
|
3996
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
3997
|
+
<xsl:param name="id"/>
|
3998
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3999
|
+
<tr>
|
4000
|
+
<td>
|
4001
|
+
<xsl:copy-of select="node()"/>
|
4002
|
+
</td>
|
4003
|
+
<td>
|
4004
|
+
|
4005
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
|
4006
|
+
|
4007
|
+
<!-- get paragraphs from nested 'dl' -->
|
4008
|
+
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
|
4009
|
+
|
4010
|
+
|
4011
|
+
</td>
|
4012
|
+
</tr>
|
4013
|
+
|
4014
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
|
4015
|
+
<xsl:for-each select="*[local-name() = 'dt']">
|
4016
|
+
<p>
|
4017
|
+
<xsl:copy-of select="node()"/>
|
4018
|
+
<xsl:text> </xsl:text>
|
4019
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
|
4020
|
+
</p>
|
4021
|
+
</xsl:for-each>
|
4022
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
|
3294
4023
|
<fo:inline font-style="italic">
|
3295
4024
|
<xsl:apply-templates/>
|
3296
4025
|
</fo:inline>
|
3297
4026
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
4027
|
+
<xsl:param name="split_keep-within-line"/>
|
3298
4028
|
<fo:inline font-weight="bold">
|
3299
4029
|
|
3300
|
-
<xsl:apply-templates
|
4030
|
+
<xsl:apply-templates>
|
4031
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4032
|
+
</xsl:apply-templates>
|
3301
4033
|
</fo:inline>
|
3302
4034
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
3303
4035
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -3318,7 +4050,7 @@
|
|
3318
4050
|
|
3319
4051
|
|
3320
4052
|
|
3321
|
-
|
4053
|
+
<!-- 10 -->
|
3322
4054
|
|
3323
4055
|
|
3324
4056
|
|
@@ -3336,13 +4068,15 @@
|
|
3336
4068
|
<xsl:choose>
|
3337
4069
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
3338
4070
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
3339
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4071
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
3340
4072
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
3341
4073
|
</xsl:choose>
|
3342
4074
|
</xsl:attribute>
|
3343
4075
|
</xsl:if>
|
3344
4076
|
<xsl:apply-templates/>
|
3345
4077
|
</fo:inline>
|
4078
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4079
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
3346
4080
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3347
4081
|
<fo:inline text-decoration="underline">
|
3348
4082
|
<xsl:apply-templates/>
|
@@ -3490,54 +4224,120 @@
|
|
3490
4224
|
<fo:block break-after="page"/>
|
3491
4225
|
<fo:block> </fo:block>
|
3492
4226
|
<fo:block break-after="page"/>
|
4227
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
4228
|
+
<xsl:apply-templates/>
|
3493
4229
|
</xsl:template><xsl:template name="tokenize">
|
3494
4230
|
<xsl:param name="text"/>
|
3495
4231
|
<xsl:param name="separator" select="' '"/>
|
3496
4232
|
<xsl:choose>
|
4233
|
+
|
4234
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
4235
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
4236
|
+
</xsl:when>
|
3497
4237
|
<xsl:when test="not(contains($text, $separator))">
|
3498
4238
|
<word>
|
3499
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
3500
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
3501
4239
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
3502
|
-
<xsl:variable name="len_str">
|
3503
|
-
<xsl:choose>
|
3504
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
3505
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
3506
|
-
</xsl:when>
|
3507
|
-
<xsl:otherwise>
|
3508
|
-
<xsl:value-of select="$len_str_tmp"/>
|
3509
|
-
</xsl:otherwise>
|
3510
|
-
</xsl:choose>
|
3511
|
-
</xsl:variable>
|
3512
|
-
|
3513
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
3514
|
-
<xsl:message>
|
3515
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
3516
|
-
len_str=<xsl:value-of select="$len_str"/>
|
3517
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
3518
|
-
</xsl:message>
|
3519
|
-
</xsl:if> -->
|
3520
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
3521
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
3522
4240
|
<xsl:choose>
|
3523
|
-
<xsl:when test="$
|
3524
|
-
<xsl:value-of select="$
|
4241
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
4242
|
+
<xsl:value-of select="$len_str_tmp"/>
|
3525
4243
|
</xsl:when>
|
3526
4244
|
<xsl:otherwise>
|
3527
|
-
<xsl:
|
4245
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4246
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4247
|
+
<xsl:variable name="len_str">
|
4248
|
+
<xsl:choose>
|
4249
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4250
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4251
|
+
</xsl:when>
|
4252
|
+
<xsl:otherwise>
|
4253
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4254
|
+
</xsl:otherwise>
|
4255
|
+
</xsl:choose>
|
4256
|
+
</xsl:variable>
|
4257
|
+
|
4258
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4259
|
+
<xsl:message>
|
4260
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4261
|
+
len_str=<xsl:value-of select="$len_str"/>
|
4262
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4263
|
+
</xsl:message>
|
4264
|
+
</xsl:if> -->
|
4265
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4266
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4267
|
+
<xsl:choose>
|
4268
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
4269
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
4270
|
+
</xsl:when>
|
4271
|
+
<xsl:otherwise>
|
4272
|
+
<xsl:value-of select="$len_str"/>
|
4273
|
+
</xsl:otherwise>
|
4274
|
+
</xsl:choose>
|
3528
4275
|
</xsl:otherwise>
|
3529
4276
|
</xsl:choose>
|
3530
4277
|
</word>
|
3531
4278
|
</xsl:when>
|
3532
4279
|
<xsl:otherwise>
|
3533
4280
|
<word>
|
3534
|
-
<xsl:
|
4281
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
4282
|
+
<xsl:choose>
|
4283
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4284
|
+
<xsl:value-of select="$word"/>
|
4285
|
+
</xsl:when>
|
4286
|
+
<xsl:otherwise>
|
4287
|
+
<xsl:value-of select="string-length($word)"/>
|
4288
|
+
</xsl:otherwise>
|
4289
|
+
</xsl:choose>
|
3535
4290
|
</word>
|
3536
4291
|
<xsl:call-template name="tokenize">
|
3537
4292
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
3538
4293
|
</xsl:call-template>
|
3539
4294
|
</xsl:otherwise>
|
3540
4295
|
</xsl:choose>
|
4296
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
4297
|
+
<xsl:param name="tags"/>
|
4298
|
+
<xsl:param name="text"/>
|
4299
|
+
<xsl:param name="separator" select="' '"/>
|
4300
|
+
<xsl:choose>
|
4301
|
+
|
4302
|
+
<xsl:when test="not(contains($text, $separator))">
|
4303
|
+
<word>
|
4304
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4305
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
4306
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4307
|
+
</xsl:call-template>
|
4308
|
+
</word>
|
4309
|
+
</xsl:when>
|
4310
|
+
<xsl:otherwise>
|
4311
|
+
<word>
|
4312
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4313
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
4314
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4315
|
+
</xsl:call-template>
|
4316
|
+
</word>
|
4317
|
+
<xsl:call-template name="tokenize_with_tags">
|
4318
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
4319
|
+
</xsl:call-template>
|
4320
|
+
</xsl:otherwise>
|
4321
|
+
</xsl:choose>
|
4322
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
4323
|
+
<xsl:param name="text"/>
|
4324
|
+
<xsl:param name="tags"/>
|
4325
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
4326
|
+
|
4327
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
4328
|
+
|
4329
|
+
<xsl:choose>
|
4330
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
4331
|
+
<xsl:otherwise>
|
4332
|
+
<xsl:element name="{$tag_name}">
|
4333
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4334
|
+
<xsl:with-param name="text" select="$text"/>
|
4335
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4336
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
4337
|
+
</xsl:call-template>
|
4338
|
+
</xsl:element>
|
4339
|
+
</xsl:otherwise>
|
4340
|
+
</xsl:choose>
|
3541
4341
|
</xsl:template><xsl:template name="max_length">
|
3542
4342
|
<xsl:param name="words"/>
|
3543
4343
|
<xsl:for-each select="$words//word">
|
@@ -3638,12 +4438,19 @@
|
|
3638
4438
|
</xsl:otherwise>
|
3639
4439
|
</xsl:choose>
|
3640
4440
|
</xsl:template><xsl:template name="getSimpleTable">
|
4441
|
+
<xsl:param name="id"/>
|
4442
|
+
|
3641
4443
|
<xsl:variable name="simple-table">
|
3642
4444
|
|
4445
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
4446
|
+
<xsl:variable name="table_without_br">
|
4447
|
+
<xsl:apply-templates mode="table-without-br"/>
|
4448
|
+
</xsl:variable>
|
4449
|
+
|
3643
4450
|
<!-- Step 1. colspan processing -->
|
3644
4451
|
<xsl:variable name="simple-table-colspan">
|
3645
4452
|
<tbody>
|
3646
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
4453
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
3647
4454
|
</tbody>
|
3648
4455
|
</xsl:variable>
|
3649
4456
|
|
@@ -3652,10 +4459,67 @@
|
|
3652
4459
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
3653
4460
|
</xsl:variable>
|
3654
4461
|
|
3655
|
-
|
3656
|
-
|
4462
|
+
<!-- Step 3: add id to each cell -->
|
4463
|
+
<!-- add <word>...</word> for each word, image, math -->
|
4464
|
+
<xsl:variable name="simple-table-id">
|
4465
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
4466
|
+
<xsl:with-param name="id" select="$id"/>
|
4467
|
+
</xsl:apply-templates>
|
4468
|
+
</xsl:variable>
|
4469
|
+
|
4470
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
4471
|
+
|
3657
4472
|
</xsl:variable>
|
3658
4473
|
<xsl:copy-of select="$simple-table"/>
|
4474
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
4475
|
+
<xsl:copy>
|
4476
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
4477
|
+
</xsl:copy>
|
4478
|
+
</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">
|
4479
|
+
<xsl:copy>
|
4480
|
+
<xsl:copy-of select="@*"/>
|
4481
|
+
<p>
|
4482
|
+
<xsl:copy-of select="node()"/>
|
4483
|
+
</p>
|
4484
|
+
</xsl:copy>
|
4485
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
4486
|
+
<xsl:copy>
|
4487
|
+
<xsl:copy-of select="@*"/>
|
4488
|
+
<xsl:for-each select="*[local-name()='br']">
|
4489
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4490
|
+
<p>
|
4491
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4492
|
+
<xsl:copy-of select="."/>
|
4493
|
+
</xsl:for-each>
|
4494
|
+
</p>
|
4495
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4496
|
+
<p>
|
4497
|
+
<xsl:for-each select="following-sibling::node()">
|
4498
|
+
<xsl:copy-of select="."/>
|
4499
|
+
</xsl:for-each>
|
4500
|
+
</p>
|
4501
|
+
</xsl:if>
|
4502
|
+
</xsl:for-each>
|
4503
|
+
</xsl:copy>
|
4504
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
4505
|
+
<xsl:for-each select="*[local-name()='br']">
|
4506
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4507
|
+
<p>
|
4508
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4509
|
+
<xsl:copy-of select="."/>
|
4510
|
+
</xsl:for-each>
|
4511
|
+
</p>
|
4512
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4513
|
+
<p>
|
4514
|
+
<xsl:for-each select="following-sibling::node()">
|
4515
|
+
<xsl:copy-of select="."/>
|
4516
|
+
</xsl:for-each>
|
4517
|
+
</p>
|
4518
|
+
</xsl:if>
|
4519
|
+
</xsl:for-each>
|
4520
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
4521
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
4522
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
3659
4523
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
3660
4524
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
3661
4525
|
</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">
|
@@ -3733,18 +4597,138 @@
|
|
3733
4597
|
</xsl:choose>
|
3734
4598
|
</xsl:for-each>
|
3735
4599
|
</xsl:variable>
|
3736
|
-
|
3737
|
-
<xsl:variable name="newRow">
|
3738
|
-
<xsl:copy>
|
3739
|
-
<xsl:copy-of select="$currentRow/@*"/>
|
3740
|
-
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
3741
|
-
</xsl:copy>
|
4600
|
+
|
4601
|
+
<xsl:variable name="newRow">
|
4602
|
+
<xsl:copy>
|
4603
|
+
<xsl:copy-of select="$currentRow/@*"/>
|
4604
|
+
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
4605
|
+
</xsl:copy>
|
4606
|
+
</xsl:variable>
|
4607
|
+
<xsl:copy-of select="$newRow"/>
|
4608
|
+
|
4609
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
4610
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
4611
|
+
</xsl:apply-templates>
|
4612
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
4613
|
+
<xsl:param name="id"/>
|
4614
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
4615
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4616
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
4617
|
+
</xsl:apply-templates>
|
4618
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
4619
|
+
<xsl:param name="id"/>
|
4620
|
+
<xsl:copy>
|
4621
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4622
|
+
<xsl:with-param name="id" select="$id"/>
|
4623
|
+
</xsl:apply-templates>
|
4624
|
+
</xsl:copy>
|
4625
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
4626
|
+
<xsl:param name="id"/>
|
4627
|
+
<xsl:copy>
|
4628
|
+
<xsl:copy-of select="@*"/>
|
4629
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
4630
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
4631
|
+
<xsl:with-param name="id" select="$id"/>
|
4632
|
+
</xsl:apply-templates>
|
4633
|
+
</xsl:copy>
|
4634
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
4635
|
+
<xsl:param name="id"/>
|
4636
|
+
<xsl:copy>
|
4637
|
+
<xsl:copy-of select="@*"/>
|
4638
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
4639
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
4640
|
+
<xsl:attribute name="id">
|
4641
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
4642
|
+
</xsl:attribute>
|
4643
|
+
|
4644
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
4645
|
+
<xsl:copy>
|
4646
|
+
<xsl:copy-of select="@*"/>
|
4647
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
4648
|
+
<xsl:attribute name="id">
|
4649
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
4650
|
+
</xsl:attribute>
|
4651
|
+
|
4652
|
+
<xsl:copy-of select="node()"/>
|
4653
|
+
</xsl:copy>
|
4654
|
+
</xsl:for-each>
|
4655
|
+
|
4656
|
+
|
4657
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
4658
|
+
|
4659
|
+
<xsl:variable name="td_text">
|
4660
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
4661
|
+
</xsl:variable>
|
4662
|
+
|
4663
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
4664
|
+
|
4665
|
+
<xsl:variable name="words">
|
4666
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
4667
|
+
<word>
|
4668
|
+
<xsl:copy-of select="."/>
|
4669
|
+
</word>
|
4670
|
+
</xsl:for-each>
|
4671
|
+
|
4672
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
4673
|
+
<xsl:copy-of select="."/>
|
4674
|
+
</xsl:for-each>
|
4675
|
+
|
4676
|
+
</xsl:variable>
|
4677
|
+
|
4678
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
4679
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
4680
|
+
<xsl:copy>
|
4681
|
+
<xsl:attribute name="id">
|
4682
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
4683
|
+
</xsl:attribute>
|
4684
|
+
<xsl:copy-of select="node()"/>
|
4685
|
+
</xsl:copy>
|
4686
|
+
</xsl:for-each>
|
4687
|
+
</xsl:if>
|
4688
|
+
</xsl:copy>
|
4689
|
+
|
4690
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
4691
|
+
<xsl:copy>
|
4692
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
4693
|
+
</xsl:copy>
|
4694
|
+
</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">
|
4695
|
+
<xsl:variable name="formatting_tags">
|
4696
|
+
<xsl:call-template name="getFormattingTags"/>
|
4697
|
+
</xsl:variable>
|
4698
|
+
<word>
|
4699
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4700
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
4701
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4702
|
+
</xsl:call-template>
|
4703
|
+
</word>
|
4704
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
4705
|
+
|
4706
|
+
<xsl:variable name="td_text" select="."/>
|
4707
|
+
|
4708
|
+
<xsl:variable name="string_with_added_zerospaces">
|
4709
|
+
<xsl:call-template name="add-zero-spaces-java">
|
4710
|
+
<xsl:with-param name="text" select="$td_text"/>
|
4711
|
+
</xsl:call-template>
|
3742
4712
|
</xsl:variable>
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
4713
|
+
|
4714
|
+
<xsl:variable name="formatting_tags">
|
4715
|
+
<xsl:call-template name="getFormattingTags"/>
|
4716
|
+
</xsl:variable>
|
4717
|
+
|
4718
|
+
<!-- <word>text</word> -->
|
4719
|
+
<xsl:call-template name="tokenize_with_tags">
|
4720
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4721
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
4722
|
+
</xsl:call-template>
|
4723
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
4724
|
+
<tags>
|
4725
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
4726
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
4727
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
4728
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
4729
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
4730
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
4731
|
+
</tags>
|
3748
4732
|
</xsl:template><xsl:template name="getLang">
|
3749
4733
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
3750
4734
|
<xsl:variable name="language">
|
@@ -3799,6 +4783,9 @@
|
|
3799
4783
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
3800
4784
|
|
3801
4785
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
4786
|
+
|
4787
|
+
|
4788
|
+
|
3802
4789
|
|
3803
4790
|
|
3804
4791
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -3806,48 +4793,80 @@
|
|
3806
4793
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
3807
4794
|
</xsl:call-template>
|
3808
4795
|
|
4796
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
4797
|
+
<!-- insert helper tag -->
|
4798
|
+
<!-- set unique font-size (fiction) -->
|
4799
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
4800
|
+
<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 -->
|
4801
|
+
</xsl:if>
|
3809
4802
|
|
3810
|
-
|
3811
|
-
|
3812
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
4803
|
+
<xsl:variable name="mathml_content">
|
4804
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
3813
4805
|
</xsl:variable>
|
3814
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
3815
4806
|
|
4807
|
+
|
4808
|
+
<xsl:call-template name="mathml_instream_object">
|
4809
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
4810
|
+
</xsl:call-template>
|
3816
4811
|
|
3817
|
-
|
3818
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
3819
|
-
<xsl:variable name="comment_text_">
|
3820
|
-
<xsl:choose>
|
3821
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
3822
|
-
<xsl:value-of select="$comment_text_following"/>
|
3823
|
-
</xsl:when>
|
3824
|
-
<xsl:otherwise>
|
3825
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
3826
|
-
</xsl:otherwise>
|
3827
|
-
</xsl:choose>
|
3828
|
-
</xsl:variable>
|
3829
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
3830
|
-
|
3831
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
3832
|
-
<!-- put Mathin Alternate Text -->
|
3833
|
-
<xsl:attribute name="fox:alt-text">
|
3834
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
3835
|
-
</xsl:attribute>
|
3836
|
-
</xsl:if>
|
3837
|
-
|
3838
|
-
<xsl:variable name="mathml_content">
|
3839
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
3840
|
-
</xsl:variable>
|
3841
|
-
<!-- put MathML in Actual Text -->
|
3842
|
-
<xsl:attribute name="fox:actual-text">
|
3843
|
-
<xsl:value-of select="$mathml_content"/>
|
3844
|
-
</xsl:attribute>
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
3849
|
-
</fo:instream-foreign-object>
|
4812
|
+
|
3850
4813
|
</fo:inline>
|
4814
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
4815
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
4816
|
+
<xsl:variable name="comment_text_">
|
4817
|
+
<xsl:choose>
|
4818
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
4819
|
+
<xsl:value-of select="$comment_text_following"/>
|
4820
|
+
</xsl:when>
|
4821
|
+
<xsl:otherwise>
|
4822
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
4823
|
+
</xsl:otherwise>
|
4824
|
+
</xsl:choose>
|
4825
|
+
</xsl:variable>
|
4826
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
4827
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
4828
|
+
<xsl:value-of select="$comment_text"/>
|
4829
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
4830
|
+
<xsl:param name="comment_text"/>
|
4831
|
+
<xsl:param name="mathml_content"/>
|
4832
|
+
|
4833
|
+
<xsl:variable name="comment_text_">
|
4834
|
+
<xsl:choose>
|
4835
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
4836
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
4837
|
+
</xsl:choose>
|
4838
|
+
</xsl:variable>
|
4839
|
+
|
4840
|
+
<xsl:variable name="mathml">
|
4841
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
4842
|
+
</xsl:variable>
|
4843
|
+
|
4844
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
4845
|
+
|
4846
|
+
|
4847
|
+
|
4848
|
+
|
4849
|
+
|
4850
|
+
|
4851
|
+
|
4852
|
+
<!-- put MathML in Actual Text -->
|
4853
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
4854
|
+
<xsl:attribute name="fox:actual-text">
|
4855
|
+
<xsl:value-of select="$mathml_content"/>
|
4856
|
+
</xsl:attribute>
|
4857
|
+
|
4858
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
4859
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
4860
|
+
<!-- put Mathin Alternate Text -->
|
4861
|
+
<xsl:attribute name="fox:alt-text">
|
4862
|
+
<xsl:value-of select="$comment_text_"/>
|
4863
|
+
</xsl:attribute>
|
4864
|
+
</xsl:if>
|
4865
|
+
<!-- </xsl:if> -->
|
4866
|
+
|
4867
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
4868
|
+
|
4869
|
+
</fo:instream-foreign-object>
|
3851
4870
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
3852
4871
|
<!-- <xsl:text>a+b</xsl:text> -->
|
3853
4872
|
<xsl:text><</xsl:text>
|
@@ -3878,7 +4897,9 @@
|
|
3878
4897
|
<!-- replace start and end spaces to non-break space -->
|
3879
4898
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
3880
4899
|
</xsl:copy>
|
3881
|
-
</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="
|
4900
|
+
</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">
|
4901
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
4902
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
3882
4903
|
<xsl:variable name="target">
|
3883
4904
|
<xsl:choose>
|
3884
4905
|
<xsl:when test="@updatetype = 'true'">
|
@@ -4469,18 +5490,33 @@
|
|
4469
5490
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
4470
5491
|
<xsl:copy>
|
4471
5492
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
4472
|
-
<xsl:variable name="
|
5493
|
+
<xsl:variable name="viewbox_">
|
4473
5494
|
<xsl:call-template name="split">
|
4474
5495
|
<xsl:with-param name="pText" select="@viewBox"/>
|
4475
5496
|
<xsl:with-param name="sep" select="' '"/>
|
4476
5497
|
</xsl:call-template>
|
4477
5498
|
</xsl:variable>
|
5499
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
5500
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
5501
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
5502
|
+
|
4478
5503
|
<xsl:attribute name="width">
|
4479
|
-
<xsl:
|
5504
|
+
<xsl:choose>
|
5505
|
+
<xsl:when test="$width != ''">
|
5506
|
+
<xsl:value-of select="round($width)"/>
|
5507
|
+
</xsl:when>
|
5508
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
5509
|
+
</xsl:choose>
|
4480
5510
|
</xsl:attribute>
|
4481
5511
|
<xsl:attribute name="height">
|
4482
|
-
<xsl:
|
5512
|
+
<xsl:choose>
|
5513
|
+
<xsl:when test="$height != ''">
|
5514
|
+
<xsl:value-of select="round($height)"/>
|
5515
|
+
</xsl:when>
|
5516
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
5517
|
+
</xsl:choose>
|
4483
5518
|
</xsl:attribute>
|
5519
|
+
|
4484
5520
|
<xsl:apply-templates mode="svg_update"/>
|
4485
5521
|
</xsl:copy>
|
4486
5522
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -4675,7 +5711,11 @@
|
|
4675
5711
|
<xsl:apply-templates mode="bookmarks"/>
|
4676
5712
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
4677
5713
|
<xsl:apply-templates select="."/>
|
4678
|
-
</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() = '
|
5714
|
+
</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">
|
5715
|
+
<xsl:apply-templates mode="contents"/>
|
5716
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
5717
|
+
<xsl:apply-templates mode="bookmarks"/>
|
5718
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
4679
5719
|
<xsl:apply-templates mode="bookmarks"/>
|
4680
5720
|
</xsl:template><xsl:template name="addBookmarks">
|
4681
5721
|
<xsl:param name="contents"/>
|
@@ -4957,7 +5997,9 @@
|
|
4957
5997
|
<xsl:apply-templates/>
|
4958
5998
|
</xsl:otherwise>
|
4959
5999
|
</xsl:choose>
|
4960
|
-
</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() = '
|
6000
|
+
</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">
|
6001
|
+
<xsl:value-of select="."/>
|
6002
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
4961
6003
|
<xsl:text> </xsl:text>
|
4962
6004
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
4963
6005
|
<xsl:copy>
|
@@ -4988,9 +6030,22 @@
|
|
4988
6030
|
</xsl:when>
|
4989
6031
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
4990
6032
|
</xsl:choose>
|
6033
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6034
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6035
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6036
|
+
<xsl:apply-templates mode="contents_item"/>
|
4991
6037
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
4992
6038
|
|
4993
6039
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6040
|
+
|
6041
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6042
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6043
|
+
</xsl:if>
|
6044
|
+
|
6045
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6046
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6047
|
+
</xsl:if>
|
6048
|
+
|
4994
6049
|
<xsl:copy-of select="@id"/>
|
4995
6050
|
|
4996
6051
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -5015,7 +6070,7 @@
|
|
5015
6070
|
|
5016
6071
|
|
5017
6072
|
|
5018
|
-
|
6073
|
+
<!-- 9 -->
|
5019
6074
|
|
5020
6075
|
|
5021
6076
|
|
@@ -5099,7 +6154,7 @@
|
|
5099
6154
|
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
5100
6155
|
<xsl:choose>
|
5101
6156
|
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
5102
|
-
<xsl:call-template name="interspers">
|
6157
|
+
<xsl:call-template name="interspers-java">
|
5103
6158
|
<xsl:with-param name="str" select="."/>
|
5104
6159
|
</xsl:call-template>
|
5105
6160
|
</xsl:when>
|
@@ -5149,6 +6204,10 @@
|
|
5149
6204
|
<xsl:with-param name="char" select="$char"/>
|
5150
6205
|
</xsl:call-template>
|
5151
6206
|
</xsl:if>
|
6207
|
+
</xsl:template><xsl:template name="interspers-java">
|
6208
|
+
<xsl:param name="str"/>
|
6209
|
+
<xsl:param name="char" select="$zero_width_space"/>
|
6210
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
|
5152
6211
|
</xsl:template><xsl:template match="*" mode="syntax_highlight">
|
5153
6212
|
<xsl:apply-templates mode="syntax_highlight"/>
|
5154
6213
|
</xsl:template><xsl:variable name="syntax_highlight_styles_">
|
@@ -5361,7 +6420,9 @@
|
|
5361
6420
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
5362
6421
|
</xsl:if>
|
5363
6422
|
<xsl:variable name="simple-table">
|
5364
|
-
<xsl:call-template name="getSimpleTable"
|
6423
|
+
<xsl:call-template name="getSimpleTable">
|
6424
|
+
<xsl:with-param name="id" select="@id"/>
|
6425
|
+
</xsl:call-template>
|
5365
6426
|
</xsl:variable>
|
5366
6427
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
5367
6428
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -5468,39 +6529,67 @@
|
|
5468
6529
|
</xsl:otherwise>
|
5469
6530
|
</xsl:choose>
|
5470
6531
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
5471
|
-
|
5472
|
-
|
6532
|
+
|
6533
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
6534
|
+
|
5473
6535
|
|
6536
|
+
|
5474
6537
|
<xsl:variable name="fo_element">
|
5475
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
6538
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
5476
6539
|
block
|
5477
6540
|
</xsl:variable>
|
5478
6541
|
|
5479
|
-
|
5480
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
5481
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5482
|
-
</xsl:apply-templates>
|
6542
|
+
<fo:block-container margin-left="0mm">
|
5483
6543
|
|
5484
|
-
|
5485
|
-
|
5486
|
-
<
|
5487
|
-
|
5488
|
-
|
6544
|
+
<xsl:choose>
|
6545
|
+
|
6546
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
6547
|
+
|
6548
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
6549
|
+
<fo:block>
|
6550
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
5489
6551
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5490
6552
|
</xsl:apply-templates>
|
6553
|
+
</fo:block>
|
6554
|
+
|
6555
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6556
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6557
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
6558
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6559
|
+
</xsl:apply-templates>
|
6560
|
+
</fo:block-container>
|
5491
6561
|
</fo:block-container>
|
5492
|
-
</
|
5493
|
-
|
5494
|
-
|
5495
|
-
|
5496
|
-
|
5497
|
-
|
5498
|
-
|
5499
|
-
|
5500
|
-
|
5501
|
-
|
5502
|
-
|
5503
|
-
|
6562
|
+
</xsl:when> <!-- end block -->
|
6563
|
+
|
6564
|
+
<xsl:otherwise> <!-- inline -->
|
6565
|
+
|
6566
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
6567
|
+
<fo:block>
|
6568
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6569
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6570
|
+
</xsl:apply-templates>
|
6571
|
+
<fo:inline>
|
6572
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
6573
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6574
|
+
</xsl:apply-templates>
|
6575
|
+
</fo:inline>
|
6576
|
+
</fo:block>
|
6577
|
+
|
6578
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
6579
|
+
<!-- display further elements in blocks -->
|
6580
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6581
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6582
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
6583
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
6584
|
+
</xsl:apply-templates>
|
6585
|
+
</fo:block-container>
|
6586
|
+
</fo:block-container>
|
6587
|
+
</xsl:if>
|
6588
|
+
</xsl:otherwise> <!-- end inline -->
|
6589
|
+
|
6590
|
+
</xsl:choose>
|
6591
|
+
</fo:block-container>
|
6592
|
+
</fo:block-container>
|
5504
6593
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
5505
6594
|
<xsl:param name="fo_element">block</xsl:param>
|
5506
6595
|
|
@@ -5532,10 +6621,16 @@
|
|
5532
6621
|
</xsl:variable>
|
5533
6622
|
<xsl:choose>
|
5534
6623
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
5535
|
-
<fo:block
|
5536
|
-
|
5537
|
-
|
5538
|
-
|
6624
|
+
<fo:block-container>
|
6625
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
6626
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6627
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6628
|
+
</xsl:if>
|
6629
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
6630
|
+
|
6631
|
+
<xsl:apply-templates/>
|
6632
|
+
</fo:block>
|
6633
|
+
</fo:block-container>
|
5539
6634
|
</xsl:when>
|
5540
6635
|
<xsl:otherwise>
|
5541
6636
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -5717,7 +6812,16 @@
|
|
5717
6812
|
</fo:inline>
|
5718
6813
|
</xsl:when>
|
5719
6814
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
5720
|
-
|
6815
|
+
|
6816
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
6817
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
6818
|
+
<xsl:choose>
|
6819
|
+
<xsl:when test="$uri_src != ''">
|
6820
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
6821
|
+
</xsl:when>
|
6822
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
6823
|
+
</xsl:choose>
|
6824
|
+
|
5721
6825
|
</xsl:otherwise>
|
5722
6826
|
</xsl:choose>
|
5723
6827
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -5899,10 +7003,24 @@
|
|
5899
7003
|
|
5900
7004
|
</fo:block>
|
5901
7005
|
<xsl:apply-templates/>
|
5902
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7006
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
5903
7007
|
<!-- comment 2019-11-29 -->
|
5904
7008
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
5905
7009
|
<xsl:apply-templates /> -->
|
7010
|
+
|
7011
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7012
|
+
|
7013
|
+
<xsl:choose>
|
7014
|
+
<!-- if there isn't the attribute '@from', then -->
|
7015
|
+
<xsl:when test="$id_from = ''">
|
7016
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7017
|
+
</xsl:when>
|
7018
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7019
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7020
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7021
|
+
</xsl:when>
|
7022
|
+
</xsl:choose>
|
7023
|
+
|
5906
7024
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
5907
7025
|
<!-- 0xA0 to space replacement -->
|
5908
7026
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -6047,6 +7165,11 @@
|
|
6047
7165
|
</xsl:otherwise>
|
6048
7166
|
</xsl:choose>
|
6049
7167
|
</xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
|
7168
|
+
|
7169
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
7170
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
7171
|
+
</xsl:apply-templates>
|
7172
|
+
|
6050
7173
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
6051
7174
|
|
6052
7175
|
|
@@ -6061,12 +7184,23 @@
|
|
6061
7184
|
|
6062
7185
|
|
6063
7186
|
|
7187
|
+
<xsl:if test="*[local-name() = 'name']">
|
7188
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
7189
|
+
</xsl:if>
|
7190
|
+
|
6064
7191
|
<xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
|
6065
7192
|
</fo:list-block>
|
6066
7193
|
<!-- <xsl:for-each select="./iho:note">
|
6067
7194
|
<xsl:call-template name="note"/>
|
6068
7195
|
</xsl:for-each> -->
|
6069
7196
|
<xsl:apply-templates select="./*[local-name() = 'note']"/>
|
7197
|
+
</xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
|
7198
|
+
<xsl:param name="process">false</xsl:param>
|
7199
|
+
<xsl:if test="$process = 'true'">
|
7200
|
+
<fo:block xsl:use-attribute-sets="list-name-style">
|
7201
|
+
<xsl:apply-templates/>
|
7202
|
+
</fo:block>
|
7203
|
+
</xsl:if>
|
6070
7204
|
</xsl:template><xsl:template match="*[local-name()='li']">
|
6071
7205
|
<fo:list-item xsl:use-attribute-sets="list-item-style">
|
6072
7206
|
<xsl:copy-of select="@id"/>
|
@@ -6263,7 +7397,10 @@
|
|
6263
7397
|
<!-- to split by '_' and other chars -->
|
6264
7398
|
<xsl:call-template name="add-zero-spaces-java"/>
|
6265
7399
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
6266
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7400
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7401
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7402
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7403
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
6267
7404
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
6268
7405
|
<!-- <row>
|
6269
7406
|
<date>05-07-2013</date>
|
@@ -6367,26 +7504,23 @@
|
|
6367
7504
|
<xsl:if test=".//*[local-name() = 'fn']">
|
6368
7505
|
<xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
|
6369
7506
|
</xsl:if>
|
7507
|
+
|
7508
|
+
<!-- display document identifier, not number [1] -->
|
6370
7509
|
<xsl:variable name="docidentifier">
|
6371
7510
|
<xsl:choose>
|
6372
7511
|
<xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
|
6373
7512
|
<xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
|
6374
7513
|
</xsl:choose>
|
6375
7514
|
</xsl:variable>
|
6376
|
-
<
|
7515
|
+
<xsl:value-of select="$docidentifier"/>
|
7516
|
+
|
6377
7517
|
<xsl:apply-templates select="*[local-name() = 'note']"/>
|
6378
|
-
|
6379
|
-
<xsl:
|
6380
|
-
<xsl:
|
6381
|
-
|
6382
|
-
|
6383
|
-
|
6384
|
-
<xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
|
6385
|
-
</xsl:when>
|
6386
|
-
<xsl:otherwise>
|
6387
|
-
<xsl:apply-templates select="*[local-name() = 'title']"/>
|
6388
|
-
</xsl:otherwise>
|
6389
|
-
</xsl:choose>
|
7518
|
+
|
7519
|
+
<xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
|
7520
|
+
<xsl:text>,</xsl:text>
|
7521
|
+
<xsl:text> </xsl:text>
|
7522
|
+
</xsl:if>
|
7523
|
+
|
6390
7524
|
<xsl:apply-templates select="*[local-name() = 'formattedref']"/>
|
6391
7525
|
<!-- end bibitem processing -->
|
6392
7526
|
|
@@ -6698,36 +7832,58 @@
|
|
6698
7832
|
|
6699
7833
|
|
6700
7834
|
|
7835
|
+
<xsl:if test="@type = 'editorial'">
|
7836
|
+
<xsl:attribute name="color">green</xsl:attribute>
|
7837
|
+
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
7838
|
+
|
7839
|
+
<!-- <xsl:variable name="note-style">
|
7840
|
+
<style xsl:use-attribute-sets="note-style"></style>
|
7841
|
+
</xsl:variable>
|
7842
|
+
<xsl:for-each select="xalan:nodeset($note-style)//style/@*">
|
7843
|
+
<xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
|
7844
|
+
</xsl:for-each> -->
|
7845
|
+
</xsl:if>
|
7846
|
+
|
7847
|
+
|
6701
7848
|
|
6702
7849
|
|
6703
7850
|
|
6704
|
-
|
6705
|
-
<xsl:
|
7851
|
+
|
7852
|
+
<xsl:call-template name="displayAdmonitionName">
|
7853
|
+
<xsl:with-param name="sep"> — </xsl:with-param>
|
7854
|
+
</xsl:call-template>
|
6706
7855
|
|
6707
7856
|
|
6708
7857
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
6709
7858
|
</fo:block>
|
6710
7859
|
|
6711
7860
|
</xsl:template><xsl:template name="displayAdmonitionName">
|
6712
|
-
|
7861
|
+
<xsl:param name="sep"/> <!-- Example: ' - ' -->
|
7862
|
+
<!-- <xsl:choose>
|
7863
|
+
<xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
|
7864
|
+
<xsl:choose>
|
7865
|
+
<xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
|
7866
|
+
<xsl:otherwise>
|
7867
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
7868
|
+
</xsl:otherwise>
|
7869
|
+
</xsl:choose>
|
7870
|
+
</xsl:when>
|
7871
|
+
<xsl:otherwise>
|
6713
7872
|
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
6714
7873
|
<xsl:if test="not(*[local-name() = 'name'])">
|
6715
7874
|
<xsl:apply-templates select="@type"/>
|
6716
7875
|
</xsl:if>
|
6717
|
-
|
6718
|
-
|
6719
|
-
<xsl:
|
6720
|
-
|
6721
|
-
<xsl:variable name="admonition_type_">
|
6722
|
-
<xsl:call-template name="getLocalizedString">
|
6723
|
-
<xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
|
6724
|
-
</xsl:call-template>
|
7876
|
+
</xsl:otherwise>
|
7877
|
+
</xsl:choose> -->
|
7878
|
+
<xsl:variable name="name">
|
7879
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
6725
7880
|
</xsl:variable>
|
6726
|
-
<xsl:
|
6727
|
-
<xsl:
|
6728
|
-
|
6729
|
-
<xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
|
7881
|
+
<xsl:copy-of select="$name"/>
|
7882
|
+
<xsl:if test="normalize-space($name) != ''">
|
7883
|
+
<xsl:value-of select="$sep"/>
|
6730
7884
|
</xsl:if>
|
7885
|
+
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
|
7886
|
+
<xsl:apply-templates/>
|
6731
7887
|
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
|
6732
7888
|
|
6733
7889
|
<fo:block xsl:use-attribute-sets="admonition-p-style">
|
@@ -6809,6 +7965,120 @@
|
|
6809
7965
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
6810
7966
|
</xsl:for-each>
|
6811
7967
|
</xsl:copy>
|
7968
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
7969
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
7970
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
7971
|
+
<xsl:copy>
|
7972
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
7973
|
+
</xsl:copy>
|
7974
|
+
</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">
|
7975
|
+
|
7976
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
7977
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
7978
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
7979
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
7980
|
+
<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))"/>
|
7981
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
7982
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
7983
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
7984
|
+
<xsl:with-param name="text" select="$text_"/>
|
7985
|
+
</xsl:call-template></text></xsl:variable>
|
7986
|
+
|
7987
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
7988
|
+
|
7989
|
+
<xsl:variable name="text2">
|
7990
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
7991
|
+
<xsl:copy-of select="."/>
|
7992
|
+
</xsl:for-each></text>
|
7993
|
+
</xsl:variable>
|
7994
|
+
|
7995
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
7996
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
7997
|
+
<xsl:variable name="text3">
|
7998
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
7999
|
+
<xsl:choose>
|
8000
|
+
<xsl:when test="self::text()">
|
8001
|
+
<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))"/>
|
8002
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8003
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8004
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8005
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8006
|
+
</xsl:call-template></text></xsl:variable>
|
8007
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8008
|
+
</xsl:when>
|
8009
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8010
|
+
</xsl:choose>
|
8011
|
+
</xsl:for-each></text>
|
8012
|
+
</xsl:variable>
|
8013
|
+
|
8014
|
+
<xsl:choose>
|
8015
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8016
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8017
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8018
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8019
|
+
<xsl:choose>
|
8020
|
+
<xsl:when test="self::text()">
|
8021
|
+
<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))"/>
|
8022
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8023
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8024
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8025
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8026
|
+
</xsl:call-template></text></xsl:variable>
|
8027
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8028
|
+
</xsl:when>
|
8029
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8030
|
+
</xsl:choose>
|
8031
|
+
</xsl:for-each>
|
8032
|
+
</xsl:when>
|
8033
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8034
|
+
</xsl:choose>
|
8035
|
+
|
8036
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8037
|
+
<xsl:param name="tag_open"/>
|
8038
|
+
<xsl:param name="tag_close"/>
|
8039
|
+
<xsl:param name="text"/>
|
8040
|
+
<xsl:choose>
|
8041
|
+
<xsl:when test="contains($text, $tag_open)">
|
8042
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8043
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8044
|
+
|
8045
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8046
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8047
|
+
</xsl:element>
|
8048
|
+
|
8049
|
+
<xsl:call-template name="replace_text_tags">
|
8050
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8051
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8052
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8053
|
+
</xsl:call-template>
|
8054
|
+
</xsl:when>
|
8055
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8056
|
+
</xsl:choose>
|
8057
|
+
</xsl:template><xsl:template name="printEdition">
|
8058
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8059
|
+
<xsl:text> </xsl:text>
|
8060
|
+
<xsl:choose>
|
8061
|
+
<xsl:when test="$edition_i18n != ''">
|
8062
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8063
|
+
<xsl:call-template name="capitalize">
|
8064
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8065
|
+
</xsl:call-template>
|
8066
|
+
</xsl:when>
|
8067
|
+
<xsl:otherwise>
|
8068
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8069
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8070
|
+
<xsl:call-template name="capitalize">
|
8071
|
+
<xsl:with-param name="str">
|
8072
|
+
<xsl:call-template name="getLocalizedString">
|
8073
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8074
|
+
</xsl:call-template>
|
8075
|
+
</xsl:with-param>
|
8076
|
+
</xsl:call-template>
|
8077
|
+
<xsl:text> </xsl:text>
|
8078
|
+
<xsl:value-of select="$edition"/>
|
8079
|
+
</xsl:if>
|
8080
|
+
</xsl:otherwise>
|
8081
|
+
</xsl:choose>
|
6812
8082
|
</xsl:template><xsl:template name="convertDate">
|
6813
8083
|
<xsl:param name="date"/>
|
6814
8084
|
<xsl:param name="format" select="'short'"/>
|
@@ -7496,4 +8766,40 @@
|
|
7496
8766
|
<xsl:value-of select="$value"/>
|
7497
8767
|
</xsl:otherwise>
|
7498
8768
|
</xsl:choose>
|
8769
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
8770
|
+
<xsl:param name="level">0</xsl:param>
|
8771
|
+
|
8772
|
+
<fo:block margin-left="{2*$level}mm">
|
8773
|
+
<xsl:text>
|
8774
|
+
<</xsl:text>
|
8775
|
+
<xsl:value-of select="local-name()"/>
|
8776
|
+
<xsl:for-each select="@*">
|
8777
|
+
<xsl:text> </xsl:text>
|
8778
|
+
<xsl:value-of select="local-name()"/>
|
8779
|
+
<xsl:text>="</xsl:text>
|
8780
|
+
<xsl:value-of select="."/>
|
8781
|
+
<xsl:text>"</xsl:text>
|
8782
|
+
</xsl:for-each>
|
8783
|
+
<xsl:text>></xsl:text>
|
8784
|
+
|
8785
|
+
<xsl:if test="not(*)">
|
8786
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
8787
|
+
<xsl:text></</xsl:text>
|
8788
|
+
<xsl:value-of select="local-name()"/>
|
8789
|
+
<xsl:text>></xsl:text>
|
8790
|
+
</xsl:if>
|
8791
|
+
</fo:block>
|
8792
|
+
|
8793
|
+
<xsl:if test="*">
|
8794
|
+
<fo:block>
|
8795
|
+
<xsl:apply-templates mode="print_as_xml">
|
8796
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
8797
|
+
</xsl:apply-templates>
|
8798
|
+
</fo:block>
|
8799
|
+
<fo:block margin-left="{2*$level}mm">
|
8800
|
+
<xsl:text></</xsl:text>
|
8801
|
+
<xsl:value-of select="local-name()"/>
|
8802
|
+
<xsl:text>></xsl:text>
|
8803
|
+
</fo:block>
|
8804
|
+
</xsl:if>
|
7499
8805
|
</xsl:template></xsl:stylesheet>
|