metanorma-bipm 2.0.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/base_convert.rb +2 -2
- data/lib/isodoc/bipm/bipm.brochure.xsl +582 -312
- data/lib/isodoc/bipm/bipm.guide.xsl +582 -312
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +582 -312
- data/lib/isodoc/bipm/bipm.rapport.xsl +582 -312
- data/lib/isodoc/bipm/doccontrol.rb +101 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +1 -0
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +564 -227
- data/lib/isodoc/bipm/presentation_xml_convert.rb +1 -93
- data/lib/isodoc/bipm/xref.rb +8 -4
- data/lib/metanorma/bipm/biblio.rng +62 -10
- data/lib/metanorma/bipm/isodoc.rng +56 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +7 -6
@@ -155,7 +155,13 @@
|
|
155
155
|
|
156
156
|
|
157
157
|
<xsl:template match="/">
|
158
|
-
<fo:root
|
158
|
+
<fo:root xml:lang="{$lang}">
|
159
|
+
<xsl:variable name="root-style">
|
160
|
+
<root-style xsl:use-attribute-sets="root-style"/>
|
161
|
+
</xsl:variable>
|
162
|
+
<xsl:call-template name="insertRootStyle">
|
163
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
164
|
+
</xsl:call-template>
|
159
165
|
<fo:layout-master-set>
|
160
166
|
<!-- cover page -->
|
161
167
|
<fo:simple-page-master master-name="cover-page-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
|
@@ -219,7 +225,7 @@
|
|
219
225
|
<fo:block font-size="10pt" border-bottom="0.5pt solid black" padding-bottom="2.5mm" margin-left="-1mm" space-after="4mm">
|
220
226
|
<!-- Example: First edition July 2009 -->
|
221
227
|
<xsl:call-template name="printEdition"/>
|
222
|
-
<xsl:text>
|
228
|
+
<xsl:text> </xsl:text>
|
223
229
|
<xsl:call-template name="convertDate">
|
224
230
|
<xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:date[@type = 'published']/jcgm:on"/>
|
225
231
|
</xsl:call-template>
|
@@ -481,7 +487,7 @@
|
|
481
487
|
</fo:block>
|
482
488
|
|
483
489
|
<xsl:variable name="edition">
|
484
|
-
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition']">
|
490
|
+
<xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
|
485
491
|
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
486
492
|
</xsl:apply-templates>
|
487
493
|
</xsl:variable>
|
@@ -788,24 +794,6 @@
|
|
788
794
|
</xsl:template>
|
789
795
|
|
790
796
|
|
791
|
-
<xsl:template match="mathml:math" priority="2">
|
792
|
-
<fo:inline font-family="Cambria Math">
|
793
|
-
<xsl:variable name="mathml">
|
794
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
795
|
-
</xsl:variable>
|
796
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
797
|
-
<xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
|
798
|
-
<xsl:attribute name="width">95%</xsl:attribute>
|
799
|
-
<xsl:attribute name="content-height">100%</xsl:attribute>
|
800
|
-
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
801
|
-
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
802
|
-
</xsl:if>
|
803
|
-
<!-- <xsl:copy-of select="."/> -->
|
804
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
805
|
-
</fo:instream-foreign-object>
|
806
|
-
</fo:inline>
|
807
|
-
</xsl:template>
|
808
|
-
|
809
797
|
<!-- for chemical expressions, when prefix superscripted -->
|
810
798
|
<xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() = '' or not(mathml:mtext/text()))]/mathml:mtext" mode="mathml" priority="2">
|
811
799
|
<mathml:mspace height="1ex"/>
|
@@ -899,29 +887,6 @@
|
|
899
887
|
</xsl:template>
|
900
888
|
|
901
889
|
|
902
|
-
<xsl:template name="printEdition">
|
903
|
-
<xsl:variable name="edition" select="normalize-space(//*[local-name()='bibdata']/*[local-name()='edition'])"/>
|
904
|
-
<xsl:text> </xsl:text>
|
905
|
-
<xsl:choose>
|
906
|
-
<xsl:when test="number($edition) = $edition">
|
907
|
-
<xsl:call-template name="number-to-words">
|
908
|
-
<xsl:with-param name="number" select="$edition"/>
|
909
|
-
</xsl:call-template>
|
910
|
-
</xsl:when>
|
911
|
-
<xsl:when test="$edition != ''">
|
912
|
-
<xsl:value-of select="$edition"/>
|
913
|
-
</xsl:when>
|
914
|
-
</xsl:choose>
|
915
|
-
<xsl:variable name="title-edition">
|
916
|
-
<xsl:call-template name="getTitle">
|
917
|
-
<xsl:with-param name="name" select="'title-edition'"/>
|
918
|
-
</xsl:call-template>
|
919
|
-
</xsl:variable>
|
920
|
-
<xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
|
921
|
-
</xsl:template>
|
922
|
-
|
923
|
-
|
924
|
-
|
925
890
|
<!-- ================ -->
|
926
891
|
<!-- JCGM specific templates -->
|
927
892
|
<!-- ================ -->
|
@@ -1146,14 +1111,8 @@
|
|
1146
1111
|
<xsl:param name="font-size" select="'65%'"/>
|
1147
1112
|
<xsl:param name="baseline-shift" select="'30%'"/>
|
1148
1113
|
<xsl:param name="curr_lang" select="'fr'"/>
|
1149
|
-
<xsl:if test="normalize-space (.) != '1'">
|
1114
|
+
<xsl:if test="normalize-space (.) != '1'"> <!-- no need to show '1st edition' -->
|
1150
1115
|
<fo:inline>
|
1151
|
-
<xsl:variable name="title-edition">
|
1152
|
-
<xsl:call-template name="getTitle">
|
1153
|
-
<xsl:with-param name="name" select="'title-edition'"/>
|
1154
|
-
<xsl:with-param name="lang" select="$curr_lang"/>
|
1155
|
-
</xsl:call-template>
|
1156
|
-
</xsl:variable>
|
1157
1116
|
<xsl:value-of select="."/>
|
1158
1117
|
<fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
|
1159
1118
|
<xsl:if test="$curr_lang = 'en'">
|
@@ -1166,7 +1125,9 @@
|
|
1166
1125
|
</xsl:call-template>
|
1167
1126
|
</fo:inline>
|
1168
1127
|
<xsl:text> </xsl:text>
|
1169
|
-
<xsl:
|
1128
|
+
<xsl:call-template name="getLocalizedString">
|
1129
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
1130
|
+
</xsl:call-template>
|
1170
1131
|
<xsl:text/>
|
1171
1132
|
</fo:inline>
|
1172
1133
|
</xsl:if>
|
@@ -1760,7 +1721,7 @@
|
|
1760
1721
|
</fo:block-container>
|
1761
1722
|
</xsl:template>
|
1762
1723
|
|
1763
|
-
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
|
1724
|
+
<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:variable name="lang">
|
1764
1725
|
<xsl:call-template name="getLang"/>
|
1765
1726
|
</xsl:variable><xsl:variable name="pageWidth_">
|
1766
1727
|
210
|
@@ -1775,20 +1736,7 @@
|
|
1775
1736
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
1776
1737
|
23.5
|
1777
1738
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
1778
|
-
|
1779
|
-
<title-edition lang="en">
|
1780
|
-
|
1781
|
-
<xsl:text>Edition </xsl:text>
|
1782
|
-
|
1783
|
-
</title-edition>
|
1784
1739
|
|
1785
|
-
<title-edition lang="fr">
|
1786
|
-
<xsl:text>Édition </xsl:text>
|
1787
|
-
</title-edition>
|
1788
|
-
|
1789
|
-
<title-edition lang="ru">
|
1790
|
-
<xsl:text>Издание </xsl:text>
|
1791
|
-
</title-edition>
|
1792
1740
|
|
1793
1741
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
1794
1742
|
<title-toc lang="en">
|
@@ -1867,7 +1815,7 @@
|
|
1867
1815
|
</xsl:variable><xsl:variable name="bibdata">
|
1868
1816
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
1869
1817
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
1870
|
-
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
1818
|
+
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="hair_space"> </xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
1871
1819
|
<xsl:param name="name"/>
|
1872
1820
|
<xsl:param name="lang"/>
|
1873
1821
|
<xsl:variable name="lang_">
|
@@ -1910,7 +1858,30 @@
|
|
1910
1858
|
|
1911
1859
|
|
1912
1860
|
|
1913
|
-
</xsl:attribute-set><xsl:
|
1861
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
1862
|
+
<xsl:param name="root-style"/>
|
1863
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
1864
|
+
|
1865
|
+
<xsl:variable name="additional_fonts_">
|
1866
|
+
<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']">
|
1867
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
1868
|
+
</xsl:for-each>
|
1869
|
+
</xsl:variable>
|
1870
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
1871
|
+
|
1872
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
1873
|
+
<xsl:choose>
|
1874
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
1875
|
+
<xsl:attribute name="{local-name()}">
|
1876
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
1877
|
+
</xsl:attribute>
|
1878
|
+
</xsl:when>
|
1879
|
+
<xsl:otherwise>
|
1880
|
+
<xsl:copy-of select="."/>
|
1881
|
+
</xsl:otherwise>
|
1882
|
+
</xsl:choose>
|
1883
|
+
</xsl:for-each>
|
1884
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
1914
1885
|
|
1915
1886
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
1916
1887
|
|
@@ -1967,7 +1938,6 @@
|
|
1967
1938
|
|
1968
1939
|
|
1969
1940
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
1970
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
1971
1941
|
|
1972
1942
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
1973
1943
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -2055,6 +2025,7 @@
|
|
2055
2025
|
|
2056
2026
|
|
2057
2027
|
|
2028
|
+
|
2058
2029
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
2059
2030
|
|
2060
2031
|
|
@@ -2451,7 +2422,7 @@
|
|
2451
2422
|
|
2452
2423
|
|
2453
2424
|
|
2454
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2425
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2455
2426
|
|
2456
2427
|
|
2457
2428
|
|
@@ -2649,6 +2620,8 @@
|
|
2649
2620
|
</xsl:attribute-set><xsl:attribute-set name="mathml-style">
|
2650
2621
|
<xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
|
2651
2622
|
|
2623
|
+
<xsl:attribute name="font-family">Cambria Math</xsl:attribute>
|
2624
|
+
|
2652
2625
|
|
2653
2626
|
</xsl:attribute-set><xsl:attribute-set name="list-style">
|
2654
2627
|
|
@@ -3159,10 +3132,41 @@
|
|
3159
3132
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3160
3133
|
<xsl:apply-templates select="."/>
|
3161
3134
|
</xsl:for-each>
|
3162
|
-
</xsl:template><xsl:template match="text()">
|
3163
|
-
|
3135
|
+
</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">
|
3136
|
+
|
3137
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3138
|
+
<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))"/>
|
3139
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3140
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3141
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3142
|
+
<xsl:with-param name="text" select="$text"/>
|
3143
|
+
</xsl:call-template>
|
3144
|
+
|
3145
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
3146
|
+
<xsl:param name="tag_open"/>
|
3147
|
+
<xsl:param name="tag_close"/>
|
3148
|
+
<xsl:param name="text"/>
|
3149
|
+
<xsl:choose>
|
3150
|
+
<xsl:when test="contains($text, $tag_open)">
|
3151
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3152
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
3153
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3154
|
+
<fo:inline keep-together.within-line="always">
|
3155
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3156
|
+
</fo:inline>
|
3157
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
3158
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3159
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
3160
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
3161
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3162
|
+
</xsl:call-template>
|
3163
|
+
</xsl:when>
|
3164
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
3165
|
+
</xsl:choose>
|
3164
3166
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3165
3167
|
<xsl:value-of select="$linebreak"/>
|
3168
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
3169
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3166
3170
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
3167
3171
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
3168
3172
|
<xsl:apply-templates/>
|
@@ -3228,8 +3232,23 @@
|
|
3228
3232
|
</xsl:call-template>
|
3229
3233
|
|
3230
3234
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
3231
|
-
|
3232
|
-
|
3235
|
+
<xsl:choose>
|
3236
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
3237
|
+
<xsl:value-of select="."/>
|
3238
|
+
</xsl:when>
|
3239
|
+
<xsl:otherwise>
|
3240
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
3241
|
+
</xsl:otherwise>
|
3242
|
+
</xsl:choose>
|
3243
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
3244
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
3245
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
3246
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
3247
|
+
<xsl:choose>
|
3248
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
3249
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
3250
|
+
</xsl:choose>
|
3251
|
+
</xsl:for-each>
|
3233
3252
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3234
3253
|
|
3235
3254
|
<xsl:variable name="table-preamble">
|
@@ -3347,16 +3366,9 @@
|
|
3347
3366
|
</xsl:for-each>
|
3348
3367
|
</xsl:when>
|
3349
3368
|
<xsl:otherwise>
|
3350
|
-
<xsl:
|
3351
|
-
<xsl:
|
3352
|
-
|
3353
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3354
|
-
</xsl:when>
|
3355
|
-
<xsl:otherwise>
|
3356
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3357
|
-
</xsl:otherwise>
|
3358
|
-
</xsl:choose>
|
3359
|
-
</xsl:for-each>
|
3369
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3370
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3371
|
+
</xsl:call-template>
|
3360
3372
|
</xsl:otherwise>
|
3361
3373
|
</xsl:choose>
|
3362
3374
|
|
@@ -3522,6 +3534,7 @@
|
|
3522
3534
|
<xsl:with-param name="text" select="$td_text"/>
|
3523
3535
|
</xsl:call-template>
|
3524
3536
|
</xsl:variable>
|
3537
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
3525
3538
|
<xsl:call-template name="tokenize">
|
3526
3539
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
3527
3540
|
<!-- 2009 thinspace -->
|
@@ -3534,6 +3547,7 @@
|
|
3534
3547
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3535
3548
|
</xsl:call-template>
|
3536
3549
|
</xsl:variable>
|
3550
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
3537
3551
|
<width>
|
3538
3552
|
<xsl:variable name="divider">
|
3539
3553
|
<xsl:choose>
|
@@ -3566,6 +3580,10 @@
|
|
3566
3580
|
<xsl:with-param name="table" select="$table"/>
|
3567
3581
|
</xsl:call-template>
|
3568
3582
|
</xsl:if>
|
3583
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
|
3584
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
3585
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
3586
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
3569
3587
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
3570
3588
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
3571
3589
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
@@ -3680,16 +3698,9 @@
|
|
3680
3698
|
</xsl:for-each>
|
3681
3699
|
</xsl:when>
|
3682
3700
|
<xsl:otherwise>
|
3683
|
-
<xsl:
|
3684
|
-
<xsl:
|
3685
|
-
|
3686
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3687
|
-
</xsl:when>
|
3688
|
-
<xsl:otherwise>
|
3689
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3690
|
-
</xsl:otherwise>
|
3691
|
-
</xsl:choose>
|
3692
|
-
</xsl:for-each>
|
3701
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3702
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3703
|
+
</xsl:call-template>
|
3693
3704
|
</xsl:otherwise>
|
3694
3705
|
</xsl:choose>
|
3695
3706
|
|
@@ -4300,8 +4311,10 @@
|
|
4300
4311
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
4301
4312
|
</xsl:variable>
|
4302
4313
|
|
4314
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
4315
|
+
|
4303
4316
|
<xsl:choose>
|
4304
|
-
<xsl:when test="$
|
4317
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
4305
4318
|
|
4306
4319
|
<fo:block margin-bottom="12pt" text-align="left">
|
4307
4320
|
|
@@ -4318,7 +4331,7 @@
|
|
4318
4331
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
4319
4332
|
</fo:block>
|
4320
4333
|
|
4321
|
-
</xsl:when>
|
4334
|
+
</xsl:when> <!-- END: only one component -->
|
4322
4335
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4323
4336
|
<fo:block margin-bottom="12pt" text-align="left">
|
4324
4337
|
|
@@ -4334,8 +4347,8 @@
|
|
4334
4347
|
</xsl:variable>
|
4335
4348
|
<xsl:value-of select="$title-where"/>
|
4336
4349
|
</fo:block>
|
4337
|
-
</xsl:when>
|
4338
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
4350
|
+
</xsl:when> <!-- END: a few components -->
|
4351
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
4339
4352
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
4340
4353
|
|
4341
4354
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
@@ -4351,11 +4364,11 @@
|
|
4351
4364
|
</xsl:variable>
|
4352
4365
|
<xsl:value-of select="$title-key"/>
|
4353
4366
|
</fo:block>
|
4354
|
-
</xsl:when>
|
4367
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
4355
4368
|
</xsl:choose>
|
4356
4369
|
|
4357
4370
|
<!-- a few components -->
|
4358
|
-
<xsl:if test="
|
4371
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
4359
4372
|
<fo:block>
|
4360
4373
|
|
4361
4374
|
<xsl:if test="$parent = 'formula'">
|
@@ -4399,21 +4412,28 @@
|
|
4399
4412
|
<xsl:apply-templates mode="dl"/>
|
4400
4413
|
</tbody>
|
4401
4414
|
</xsl:variable>
|
4402
|
-
<!-- html-table<xsl:copy-of select="$html-table"/> -->
|
4415
|
+
<!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
|
4403
4416
|
<xsl:variable name="colwidths">
|
4404
4417
|
<xsl:call-template name="calculate-column-widths">
|
4405
4418
|
<xsl:with-param name="cols-count" select="2"/>
|
4406
4419
|
<xsl:with-param name="table" select="$html-table"/>
|
4407
4420
|
</xsl:call-template>
|
4408
4421
|
</xsl:variable>
|
4409
|
-
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4422
|
+
<!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4410
4423
|
<xsl:variable name="maxlength_dt">
|
4411
4424
|
<xsl:call-template name="getMaxLength_dt"/>
|
4412
4425
|
</xsl:variable>
|
4426
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
4427
|
+
false
|
4428
|
+
</xsl:variable>
|
4429
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
4430
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
4413
4431
|
<xsl:call-template name="setColumnWidth_dl">
|
4414
4432
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4415
4433
|
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4434
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
4416
4435
|
</xsl:call-template>
|
4436
|
+
|
4417
4437
|
<fo:table-body>
|
4418
4438
|
<xsl:apply-templates>
|
4419
4439
|
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
@@ -4422,12 +4442,13 @@
|
|
4422
4442
|
</fo:table>
|
4423
4443
|
</fo:block>
|
4424
4444
|
</fo:block>
|
4425
|
-
</xsl:if>
|
4445
|
+
</xsl:if> <!-- END: a few components -->
|
4426
4446
|
</fo:block-container>
|
4427
4447
|
</fo:block-container>
|
4428
4448
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
4429
4449
|
<xsl:param name="colwidths"/>
|
4430
4450
|
<xsl:param name="maxlength_dt"/>
|
4451
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
4431
4452
|
<xsl:choose>
|
4432
4453
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
4433
4454
|
<fo:table-column column-width="50%"/>
|
@@ -4435,6 +4456,11 @@
|
|
4435
4456
|
</xsl:when>
|
4436
4457
|
<xsl:otherwise>
|
4437
4458
|
<xsl:choose>
|
4459
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
4460
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4461
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4462
|
+
</xsl:call-template>
|
4463
|
+
</xsl:when>
|
4438
4464
|
<!-- to set width check most wide chars like `W` -->
|
4439
4465
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
4440
4466
|
<fo:table-column column-width="7%"/>
|
@@ -4465,20 +4491,25 @@
|
|
4465
4491
|
<fo:table-column column-width="60%"/>
|
4466
4492
|
</xsl:when>
|
4467
4493
|
<xsl:otherwise>
|
4468
|
-
<xsl:
|
4469
|
-
<xsl:
|
4470
|
-
|
4471
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
4472
|
-
</xsl:when>
|
4473
|
-
<xsl:otherwise>
|
4474
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4475
|
-
</xsl:otherwise>
|
4476
|
-
</xsl:choose>
|
4477
|
-
</xsl:for-each>
|
4494
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4495
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4496
|
+
</xsl:call-template>
|
4478
4497
|
</xsl:otherwise>
|
4479
4498
|
</xsl:choose>
|
4480
4499
|
</xsl:otherwise>
|
4481
4500
|
</xsl:choose>
|
4501
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
4502
|
+
<xsl:param name="colwidths"/>
|
4503
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
4504
|
+
<xsl:choose>
|
4505
|
+
<xsl:when test=". = 1 or . = 0">
|
4506
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
4507
|
+
</xsl:when>
|
4508
|
+
<xsl:otherwise>
|
4509
|
+
<fo:table-column column-width="proportional-column-width({.})"/>
|
4510
|
+
</xsl:otherwise>
|
4511
|
+
</xsl:choose>
|
4512
|
+
</xsl:for-each>
|
4482
4513
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
4483
4514
|
<xsl:variable name="lengths">
|
4484
4515
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -4502,7 +4533,6 @@
|
|
4502
4533
|
<xsl:value-of select="$maxLength"/>
|
4503
4534
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
4504
4535
|
<xsl:param name="key_iso"/>
|
4505
|
-
|
4506
4536
|
<!-- <tr>
|
4507
4537
|
<td>NOTE</td>
|
4508
4538
|
<td>
|
@@ -4510,18 +4540,30 @@
|
|
4510
4540
|
</td>
|
4511
4541
|
</tr>
|
4512
4542
|
-->
|
4513
|
-
|
4543
|
+
<!-- OLD Variant -->
|
4544
|
+
<!-- <fo:table-row>
|
4514
4545
|
<fo:table-cell>
|
4515
4546
|
<fo:block margin-top="6pt">
|
4516
4547
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4517
4548
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4518
4549
|
</xsl:if>
|
4519
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
4550
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
4520
4551
|
</fo:block>
|
4521
4552
|
</fo:table-cell>
|
4522
4553
|
<fo:table-cell>
|
4523
4554
|
<fo:block>
|
4524
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
4555
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
4556
|
+
</fo:block>
|
4557
|
+
</fo:table-cell>
|
4558
|
+
</fo:table-row> -->
|
4559
|
+
<!-- <tr>
|
4560
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
4561
|
+
</tr>
|
4562
|
+
-->
|
4563
|
+
<fo:table-row>
|
4564
|
+
<fo:table-cell number-columns-spanned="2">
|
4565
|
+
<fo:block>
|
4566
|
+
<xsl:call-template name="note"/>
|
4525
4567
|
</fo:block>
|
4526
4568
|
</fo:table-cell>
|
4527
4569
|
</fo:table-row>
|
@@ -4623,13 +4665,15 @@
|
|
4623
4665
|
<xsl:choose>
|
4624
4666
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4625
4667
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4626
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4668
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4627
4669
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4628
4670
|
</xsl:choose>
|
4629
4671
|
</xsl:attribute>
|
4630
4672
|
</xsl:if>
|
4631
4673
|
<xsl:apply-templates/>
|
4632
4674
|
</fo:inline>
|
4675
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4676
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
4633
4677
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
4634
4678
|
<fo:inline text-decoration="underline">
|
4635
4679
|
<xsl:apply-templates/>
|
@@ -4777,41 +4821,50 @@
|
|
4777
4821
|
<fo:block break-after="page"/>
|
4778
4822
|
<fo:block> </fo:block>
|
4779
4823
|
<fo:block break-after="page"/>
|
4824
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
4825
|
+
<xsl:apply-templates/>
|
4780
4826
|
</xsl:template><xsl:template name="tokenize">
|
4781
4827
|
<xsl:param name="text"/>
|
4782
4828
|
<xsl:param name="separator" select="' '"/>
|
4783
4829
|
<xsl:choose>
|
4784
4830
|
<xsl:when test="not(contains($text, $separator))">
|
4785
4831
|
<word>
|
4786
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4787
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4788
4832
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
4789
|
-
<xsl:variable name="len_str">
|
4790
|
-
<xsl:choose>
|
4791
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4792
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4793
|
-
</xsl:when>
|
4794
|
-
<xsl:otherwise>
|
4795
|
-
<xsl:value-of select="$len_str_tmp"/>
|
4796
|
-
</xsl:otherwise>
|
4797
|
-
</xsl:choose>
|
4798
|
-
</xsl:variable>
|
4799
|
-
|
4800
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4801
|
-
<xsl:message>
|
4802
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4803
|
-
len_str=<xsl:value-of select="$len_str"/>
|
4804
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4805
|
-
</xsl:message>
|
4806
|
-
</xsl:if> -->
|
4807
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4808
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4809
4833
|
<xsl:choose>
|
4810
|
-
<xsl:when test="$
|
4811
|
-
<xsl:value-of select="$
|
4834
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
4835
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4812
4836
|
</xsl:when>
|
4813
4837
|
<xsl:otherwise>
|
4814
|
-
<xsl:
|
4838
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4839
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4840
|
+
<xsl:variable name="len_str">
|
4841
|
+
<xsl:choose>
|
4842
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4843
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4844
|
+
</xsl:when>
|
4845
|
+
<xsl:otherwise>
|
4846
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4847
|
+
</xsl:otherwise>
|
4848
|
+
</xsl:choose>
|
4849
|
+
</xsl:variable>
|
4850
|
+
|
4851
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4852
|
+
<xsl:message>
|
4853
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4854
|
+
len_str=<xsl:value-of select="$len_str"/>
|
4855
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4856
|
+
</xsl:message>
|
4857
|
+
</xsl:if> -->
|
4858
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4859
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4860
|
+
<xsl:choose>
|
4861
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
4862
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
4863
|
+
</xsl:when>
|
4864
|
+
<xsl:otherwise>
|
4865
|
+
<xsl:value-of select="$len_str"/>
|
4866
|
+
</xsl:otherwise>
|
4867
|
+
</xsl:choose>
|
4815
4868
|
</xsl:otherwise>
|
4816
4869
|
</xsl:choose>
|
4817
4870
|
</word>
|
@@ -4897,24 +4950,28 @@
|
|
4897
4950
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
4898
4951
|
<xsl:param name="text" select="."/>
|
4899
4952
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
4953
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
4900
4954
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
4955
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
4901
4956
|
<xsl:variable name="zero-space"></xsl:variable>
|
4902
4957
|
<xsl:choose>
|
4903
4958
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
4904
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
4959
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
4905
4960
|
<xsl:value-of select="$zero-space-after-equals"/>
|
4906
4961
|
<xsl:value-of select="$zero-space"/>
|
4907
4962
|
<xsl:call-template name="add-zero-spaces-equal">
|
4908
4963
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
4909
|
-
</xsl:call-template>
|
4964
|
+
</xsl:call-template> -->
|
4965
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
4910
4966
|
</xsl:when>
|
4911
4967
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
4912
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
4968
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
4913
4969
|
<xsl:value-of select="$zero-space-after-equal"/>
|
4914
4970
|
<xsl:value-of select="$zero-space"/>
|
4915
4971
|
<xsl:call-template name="add-zero-spaces-equal">
|
4916
4972
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
4917
|
-
</xsl:call-template>
|
4973
|
+
</xsl:call-template> -->
|
4974
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
4918
4975
|
</xsl:when>
|
4919
4976
|
<xsl:otherwise>
|
4920
4977
|
<xsl:value-of select="$text"/>
|
@@ -5082,6 +5139,9 @@
|
|
5082
5139
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
5083
5140
|
|
5084
5141
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
5142
|
+
|
5143
|
+
|
5144
|
+
|
5085
5145
|
|
5086
5146
|
|
5087
5147
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -5089,48 +5149,87 @@
|
|
5089
5149
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5090
5150
|
</xsl:call-template>
|
5091
5151
|
|
5152
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
5153
|
+
<!-- insert helper tag -->
|
5154
|
+
<!-- set unique font-size (fiction) -->
|
5155
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
5156
|
+
<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 -->
|
5157
|
+
</xsl:if>
|
5092
5158
|
|
5093
|
-
|
5094
|
-
|
5095
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
5159
|
+
<xsl:variable name="mathml_content">
|
5160
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5096
5161
|
</xsl:variable>
|
5097
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
5098
5162
|
|
5163
|
+
|
5164
|
+
<xsl:call-template name="mathml_instream_object">
|
5165
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
5166
|
+
</xsl:call-template>
|
5099
5167
|
|
5100
|
-
|
5101
|
-
|
5102
|
-
|
5103
|
-
|
5104
|
-
|
5105
|
-
|
5106
|
-
|
5107
|
-
|
5108
|
-
|
5109
|
-
|
5110
|
-
|
5111
|
-
</xsl:
|
5112
|
-
|
5113
|
-
|
5114
|
-
|
5115
|
-
|
5116
|
-
|
5117
|
-
|
5118
|
-
|
5168
|
+
|
5169
|
+
</fo:inline>
|
5170
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
5171
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5172
|
+
<xsl:variable name="comment_text_">
|
5173
|
+
<xsl:choose>
|
5174
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5175
|
+
<xsl:value-of select="$comment_text_following"/>
|
5176
|
+
</xsl:when>
|
5177
|
+
<xsl:otherwise>
|
5178
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5179
|
+
</xsl:otherwise>
|
5180
|
+
</xsl:choose>
|
5181
|
+
</xsl:variable>
|
5182
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5183
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
5184
|
+
<xsl:value-of select="$comment_text"/>
|
5185
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
5186
|
+
<xsl:param name="comment_text"/>
|
5187
|
+
<xsl:param name="mathml_content"/>
|
5188
|
+
|
5189
|
+
<xsl:variable name="comment_text_">
|
5190
|
+
<xsl:choose>
|
5191
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
5192
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
5193
|
+
</xsl:choose>
|
5194
|
+
</xsl:variable>
|
5195
|
+
|
5196
|
+
<xsl:variable name="mathml">
|
5197
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
5198
|
+
</xsl:variable>
|
5199
|
+
|
5200
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
5201
|
+
|
5202
|
+
|
5203
|
+
|
5204
|
+
|
5205
|
+
|
5206
|
+
|
5207
|
+
<xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
|
5208
|
+
<xsl:attribute name="width">95%</xsl:attribute>
|
5209
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
5210
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
5211
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
5119
5212
|
</xsl:if>
|
5120
|
-
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
<xsl:
|
5126
|
-
|
5213
|
+
|
5214
|
+
|
5215
|
+
<!-- put MathML in Actual Text -->
|
5216
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
5217
|
+
<xsl:attribute name="fox:actual-text">
|
5218
|
+
<xsl:value-of select="$mathml_content"/>
|
5219
|
+
</xsl:attribute>
|
5220
|
+
|
5221
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
5222
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
5223
|
+
<!-- put Mathin Alternate Text -->
|
5224
|
+
<xsl:attribute name="fox:alt-text">
|
5225
|
+
<xsl:value-of select="$comment_text_"/>
|
5127
5226
|
</xsl:attribute>
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
</fo:
|
5227
|
+
</xsl:if>
|
5228
|
+
<!-- </xsl:if> -->
|
5229
|
+
|
5230
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5231
|
+
|
5232
|
+
</fo:instream-foreign-object>
|
5134
5233
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
5135
5234
|
<!-- <xsl:text>a+b</xsl:text> -->
|
5136
5235
|
<xsl:text><</xsl:text>
|
@@ -5161,7 +5260,9 @@
|
|
5161
5260
|
<!-- replace start and end spaces to non-break space -->
|
5162
5261
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
5163
5262
|
</xsl:copy>
|
5164
|
-
</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="
|
5263
|
+
</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">
|
5264
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
5265
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
5165
5266
|
<xsl:variable name="target">
|
5166
5267
|
<xsl:choose>
|
5167
5268
|
<xsl:when test="@updatetype = 'true'">
|
@@ -5390,7 +5491,12 @@
|
|
5390
5491
|
|
5391
5492
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
5392
5493
|
|
5494
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
5495
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
5496
|
+
</xsl:if>
|
5497
|
+
|
5393
5498
|
|
5499
|
+
|
5394
5500
|
|
5395
5501
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
5396
5502
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -5749,18 +5855,33 @@
|
|
5749
5855
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
5750
5856
|
<xsl:copy>
|
5751
5857
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
5752
|
-
<xsl:variable name="
|
5858
|
+
<xsl:variable name="viewbox_">
|
5753
5859
|
<xsl:call-template name="split">
|
5754
5860
|
<xsl:with-param name="pText" select="@viewBox"/>
|
5755
5861
|
<xsl:with-param name="sep" select="' '"/>
|
5756
5862
|
</xsl:call-template>
|
5757
5863
|
</xsl:variable>
|
5864
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
5865
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
5866
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
5867
|
+
|
5758
5868
|
<xsl:attribute name="width">
|
5759
|
-
<xsl:
|
5869
|
+
<xsl:choose>
|
5870
|
+
<xsl:when test="$width != ''">
|
5871
|
+
<xsl:value-of select="round($width)"/>
|
5872
|
+
</xsl:when>
|
5873
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
5874
|
+
</xsl:choose>
|
5760
5875
|
</xsl:attribute>
|
5761
5876
|
<xsl:attribute name="height">
|
5762
|
-
<xsl:
|
5877
|
+
<xsl:choose>
|
5878
|
+
<xsl:when test="$height != ''">
|
5879
|
+
<xsl:value-of select="round($height)"/>
|
5880
|
+
</xsl:when>
|
5881
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
5882
|
+
</xsl:choose>
|
5763
5883
|
</xsl:attribute>
|
5884
|
+
|
5764
5885
|
<xsl:apply-templates mode="svg_update"/>
|
5765
5886
|
</xsl:copy>
|
5766
5887
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -5955,7 +6076,11 @@
|
|
5955
6076
|
<xsl:apply-templates mode="bookmarks"/>
|
5956
6077
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
5957
6078
|
<xsl:apply-templates select="."/>
|
5958
|
-
</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() = '
|
6079
|
+
</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">
|
6080
|
+
<xsl:apply-templates mode="contents"/>
|
6081
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
6082
|
+
<xsl:apply-templates mode="bookmarks"/>
|
6083
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
5959
6084
|
<xsl:apply-templates mode="bookmarks"/>
|
5960
6085
|
</xsl:template><xsl:template name="addBookmarks">
|
5961
6086
|
<xsl:param name="contents"/>
|
@@ -6237,7 +6362,9 @@
|
|
6237
6362
|
<xsl:apply-templates/>
|
6238
6363
|
</xsl:otherwise>
|
6239
6364
|
</xsl:choose>
|
6240
|
-
</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() = '
|
6365
|
+
</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">
|
6366
|
+
<xsl:value-of select="."/>
|
6367
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
6241
6368
|
<xsl:text> </xsl:text>
|
6242
6369
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
6243
6370
|
<xsl:copy>
|
@@ -6268,9 +6395,22 @@
|
|
6268
6395
|
</xsl:when>
|
6269
6396
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
6270
6397
|
</xsl:choose>
|
6398
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6399
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6400
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6401
|
+
<xsl:apply-templates mode="contents_item"/>
|
6271
6402
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
6272
6403
|
|
6273
6404
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6405
|
+
|
6406
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6407
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6408
|
+
</xsl:if>
|
6409
|
+
|
6410
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6411
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6412
|
+
</xsl:if>
|
6413
|
+
|
6274
6414
|
<xsl:copy-of select="@id"/>
|
6275
6415
|
|
6276
6416
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -6370,17 +6510,15 @@
|
|
6370
6510
|
|
6371
6511
|
<!-- split text by zero-width space -->
|
6372
6512
|
<xsl:variable name="text_step4">
|
6373
|
-
<xsl:call-template name="
|
6513
|
+
<xsl:call-template name="split_for_interspers">
|
6374
6514
|
<xsl:with-param name="pText" select="$text_step3"/>
|
6375
6515
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
6376
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
6377
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
6378
6516
|
</xsl:call-template>
|
6379
6517
|
</xsl:variable>
|
6380
6518
|
|
6381
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
6519
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
6382
6520
|
<xsl:choose>
|
6383
|
-
<xsl:when test="
|
6521
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
6384
6522
|
<xsl:call-template name="interspers">
|
6385
6523
|
<xsl:with-param name="str" select="."/>
|
6386
6524
|
</xsl:call-template>
|
@@ -6391,6 +6529,30 @@
|
|
6391
6529
|
</xsl:choose>
|
6392
6530
|
</xsl:for-each>
|
6393
6531
|
|
6532
|
+
</xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
|
6533
|
+
<xsl:param name="pText" select="."/>
|
6534
|
+
<xsl:param name="sep" select="','"/>
|
6535
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
6536
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
6537
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
6538
|
+
<xsl:call-template name="replace_tag_interspers">
|
6539
|
+
<xsl:with-param name="text" select="$text"/>
|
6540
|
+
</xsl:call-template>
|
6541
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
6542
|
+
<xsl:param name="text"/>
|
6543
|
+
<xsl:choose>
|
6544
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
6545
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
6546
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
6547
|
+
<interspers>
|
6548
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
6549
|
+
</interspers>
|
6550
|
+
<xsl:call-template name="replace_tag_interspers">
|
6551
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
6552
|
+
</xsl:call-template>
|
6553
|
+
</xsl:when>
|
6554
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
6555
|
+
</xsl:choose>
|
6394
6556
|
</xsl:template><xsl:template name="interspers">
|
6395
6557
|
<xsl:param name="str"/>
|
6396
6558
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -6726,39 +6888,67 @@
|
|
6726
6888
|
</xsl:otherwise>
|
6727
6889
|
</xsl:choose>
|
6728
6890
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
6729
|
-
|
6730
|
-
|
6891
|
+
|
6892
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
6893
|
+
|
6731
6894
|
|
6895
|
+
|
6732
6896
|
<xsl:variable name="fo_element">
|
6733
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
6897
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
6734
6898
|
inline
|
6735
6899
|
</xsl:variable>
|
6736
6900
|
|
6737
|
-
|
6738
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
6739
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6740
|
-
</xsl:apply-templates>
|
6901
|
+
<fo:block-container margin-left="0mm">
|
6741
6902
|
|
6742
|
-
|
6743
|
-
|
6744
|
-
<
|
6745
|
-
|
6746
|
-
|
6903
|
+
<xsl:choose>
|
6904
|
+
|
6905
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
6906
|
+
|
6907
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
6908
|
+
<fo:block>
|
6909
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6747
6910
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6748
6911
|
</xsl:apply-templates>
|
6912
|
+
</fo:block>
|
6913
|
+
|
6914
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6915
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6916
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
6917
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6918
|
+
</xsl:apply-templates>
|
6919
|
+
</fo:block-container>
|
6749
6920
|
</fo:block-container>
|
6750
|
-
</
|
6751
|
-
|
6752
|
-
|
6753
|
-
|
6754
|
-
|
6755
|
-
|
6756
|
-
|
6757
|
-
|
6758
|
-
|
6759
|
-
|
6760
|
-
|
6761
|
-
|
6921
|
+
</xsl:when> <!-- end block -->
|
6922
|
+
|
6923
|
+
<xsl:otherwise> <!-- inline -->
|
6924
|
+
|
6925
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
6926
|
+
<fo:block>
|
6927
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6928
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6929
|
+
</xsl:apply-templates>
|
6930
|
+
<fo:inline>
|
6931
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
6932
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6933
|
+
</xsl:apply-templates>
|
6934
|
+
</fo:inline>
|
6935
|
+
</fo:block>
|
6936
|
+
|
6937
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
6938
|
+
<!-- display further elements in blocks -->
|
6939
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6940
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6941
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
6942
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
6943
|
+
</xsl:apply-templates>
|
6944
|
+
</fo:block-container>
|
6945
|
+
</fo:block-container>
|
6946
|
+
</xsl:if>
|
6947
|
+
</xsl:otherwise> <!-- end inline -->
|
6948
|
+
|
6949
|
+
</xsl:choose>
|
6950
|
+
</fo:block-container>
|
6951
|
+
</fo:block-container>
|
6762
6952
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
6763
6953
|
<xsl:param name="fo_element">block</xsl:param>
|
6764
6954
|
|
@@ -6795,10 +6985,16 @@
|
|
6795
6985
|
</xsl:variable>
|
6796
6986
|
<xsl:choose>
|
6797
6987
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
6798
|
-
<fo:block
|
6799
|
-
|
6800
|
-
|
6801
|
-
|
6988
|
+
<fo:block-container>
|
6989
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
6990
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6991
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6992
|
+
</xsl:if>
|
6993
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
6994
|
+
|
6995
|
+
<xsl:apply-templates/>
|
6996
|
+
</fo:block>
|
6997
|
+
</fo:block-container>
|
6802
6998
|
</xsl:when>
|
6803
6999
|
<xsl:otherwise>
|
6804
7000
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -6843,7 +7039,7 @@
|
|
6843
7039
|
</xsl:otherwise>
|
6844
7040
|
</xsl:choose> -->
|
6845
7041
|
</fo:block>
|
6846
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
7042
|
+
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
|
6847
7043
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
6848
7044
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
6849
7045
|
<xsl:if test="normalize-space() != ''">
|
@@ -6879,7 +7075,8 @@
|
|
6879
7075
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
6880
7076
|
</xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
|
6881
7077
|
<xsl:if test="normalize-space() != ''">
|
6882
|
-
<xsl:value-of select="."/>
|
7078
|
+
<!-- <xsl:value-of select="."/> -->
|
7079
|
+
<xsl:call-template name="text"/>
|
6883
7080
|
</xsl:if>
|
6884
7081
|
</xsl:template><xsl:template match="*[local-name() = 'quote']">
|
6885
7082
|
<fo:block-container margin-left="0mm">
|
@@ -6986,7 +7183,16 @@
|
|
6986
7183
|
</fo:inline>
|
6987
7184
|
</xsl:when>
|
6988
7185
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
6989
|
-
|
7186
|
+
|
7187
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
7188
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
7189
|
+
<xsl:choose>
|
7190
|
+
<xsl:when test="$uri_src != ''">
|
7191
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
7192
|
+
</xsl:when>
|
7193
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
7194
|
+
</xsl:choose>
|
7195
|
+
|
6990
7196
|
</xsl:otherwise>
|
6991
7197
|
</xsl:choose>
|
6992
7198
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -7166,10 +7372,24 @@
|
|
7166
7372
|
|
7167
7373
|
</fo:block>
|
7168
7374
|
<xsl:apply-templates/>
|
7169
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7375
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
7170
7376
|
<!-- comment 2019-11-29 -->
|
7171
7377
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
7172
7378
|
<xsl:apply-templates /> -->
|
7379
|
+
|
7380
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7381
|
+
|
7382
|
+
<xsl:choose>
|
7383
|
+
<!-- if there isn't the attribute '@from', then -->
|
7384
|
+
<xsl:when test="$id_from = ''">
|
7385
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7386
|
+
</xsl:when>
|
7387
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7388
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7389
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7390
|
+
</xsl:when>
|
7391
|
+
</xsl:choose>
|
7392
|
+
|
7173
7393
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
7174
7394
|
<!-- 0xA0 to space replacement -->
|
7175
7395
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -7528,7 +7748,10 @@
|
|
7528
7748
|
<!-- to split by '_' and other chars -->
|
7529
7749
|
<xsl:call-template name="add-zero-spaces-java"/>
|
7530
7750
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
7531
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7751
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7752
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7753
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7754
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
|
7532
7755
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
7533
7756
|
<!-- <row>
|
7534
7757
|
<date>05-07-2013</date>
|
@@ -8074,6 +8297,120 @@
|
|
8074
8297
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8075
8298
|
</xsl:for-each>
|
8076
8299
|
</xsl:copy>
|
8300
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
8301
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
8302
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
8303
|
+
<xsl:copy>
|
8304
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
8305
|
+
</xsl:copy>
|
8306
|
+
</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">
|
8307
|
+
|
8308
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
8309
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
8310
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8311
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8312
|
+
<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))"/>
|
8313
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
8314
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8315
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8316
|
+
<xsl:with-param name="text" select="$text_"/>
|
8317
|
+
</xsl:call-template></text></xsl:variable>
|
8318
|
+
|
8319
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
8320
|
+
|
8321
|
+
<xsl:variable name="text2">
|
8322
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
8323
|
+
<xsl:copy-of select="."/>
|
8324
|
+
</xsl:for-each></text>
|
8325
|
+
</xsl:variable>
|
8326
|
+
|
8327
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
8328
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
8329
|
+
<xsl:variable name="text3">
|
8330
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
8331
|
+
<xsl:choose>
|
8332
|
+
<xsl:when test="self::text()">
|
8333
|
+
<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))"/>
|
8334
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8335
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8336
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8337
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8338
|
+
</xsl:call-template></text></xsl:variable>
|
8339
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8340
|
+
</xsl:when>
|
8341
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8342
|
+
</xsl:choose>
|
8343
|
+
</xsl:for-each></text>
|
8344
|
+
</xsl:variable>
|
8345
|
+
|
8346
|
+
<xsl:choose>
|
8347
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8348
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8349
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8350
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8351
|
+
<xsl:choose>
|
8352
|
+
<xsl:when test="self::text()">
|
8353
|
+
<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))"/>
|
8354
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8355
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8356
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8357
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8358
|
+
</xsl:call-template></text></xsl:variable>
|
8359
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8360
|
+
</xsl:when>
|
8361
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8362
|
+
</xsl:choose>
|
8363
|
+
</xsl:for-each>
|
8364
|
+
</xsl:when>
|
8365
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8366
|
+
</xsl:choose>
|
8367
|
+
|
8368
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8369
|
+
<xsl:param name="tag_open"/>
|
8370
|
+
<xsl:param name="tag_close"/>
|
8371
|
+
<xsl:param name="text"/>
|
8372
|
+
<xsl:choose>
|
8373
|
+
<xsl:when test="contains($text, $tag_open)">
|
8374
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8375
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8376
|
+
|
8377
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8378
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8379
|
+
</xsl:element>
|
8380
|
+
|
8381
|
+
<xsl:call-template name="replace_text_tags">
|
8382
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8383
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8384
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8385
|
+
</xsl:call-template>
|
8386
|
+
</xsl:when>
|
8387
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8388
|
+
</xsl:choose>
|
8389
|
+
</xsl:template><xsl:template name="printEdition">
|
8390
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8391
|
+
<xsl:text> </xsl:text>
|
8392
|
+
<xsl:choose>
|
8393
|
+
<xsl:when test="$edition_i18n != ''">
|
8394
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8395
|
+
<xsl:call-template name="capitalize">
|
8396
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8397
|
+
</xsl:call-template>
|
8398
|
+
</xsl:when>
|
8399
|
+
<xsl:otherwise>
|
8400
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8401
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8402
|
+
<xsl:call-template name="capitalize">
|
8403
|
+
<xsl:with-param name="str">
|
8404
|
+
<xsl:call-template name="getLocalizedString">
|
8405
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8406
|
+
</xsl:call-template>
|
8407
|
+
</xsl:with-param>
|
8408
|
+
</xsl:call-template>
|
8409
|
+
<xsl:text> </xsl:text>
|
8410
|
+
<xsl:value-of select="$edition"/>
|
8411
|
+
</xsl:if>
|
8412
|
+
</xsl:otherwise>
|
8413
|
+
</xsl:choose>
|
8077
8414
|
</xsl:template><xsl:template name="convertDate">
|
8078
8415
|
<xsl:param name="date"/>
|
8079
8416
|
<xsl:param name="format" select="'short'"/>
|