metanorma-iec 2.0.6 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iec/html/html_iec_titlepage.html +1 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +559 -184
- data/lib/isodoc/iec/init.rb +6 -5
- data/lib/isodoc/iec/presentation_xml_convert.rb +3 -3
- data/lib/isodoc/iec/xref.rb +4 -0
- data/lib/metanorma/iec/biblio.rng +62 -10
- data/lib/metanorma/iec/front.rb +1 -1
- data/lib/metanorma/iec/iec.rng +1 -0
- data/lib/metanorma/iec/isodoc.rng +56 -0
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +1 -1
- data/spec/isodoc/blocks_spec.rb +146 -202
- data/spec/isodoc/i18n_spec.rb +22 -7
- data/spec/isodoc/iev_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +255 -249
- data/spec/isodoc/ref_spec.rb +18 -66
- data/spec/metanorma/base_spec.rb +2 -2
- data/spec/metanorma/blocks_spec.rb +2 -2
- data/spec/metanorma/cleanup_spec.rb +1 -1
- data/spec/metanorma/iev_spec.rb +1 -1
- data/spec/metanorma/inline_spec.rb +86 -70
- data/spec/metanorma/section_spec.rb +196 -183
- metadata +4 -4
@@ -114,7 +114,13 @@
|
|
114
114
|
<xsl:call-template name="namespaceCheck"/>
|
115
115
|
<!-- https://stackoverflow.com/questions/25261949/xsl-fo-letter-spacing-with-text-align -->
|
116
116
|
<!-- https://xmlgraphics.apache.org/fop/knownissues.html -->
|
117
|
-
<fo:root
|
117
|
+
<fo:root xml:lang="{$lang}">
|
118
|
+
<xsl:variable name="root-style">
|
119
|
+
<root-style xsl:use-attribute-sets="root-style"/>
|
120
|
+
</xsl:variable>
|
121
|
+
<xsl:call-template name="insertRootStyle">
|
122
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
123
|
+
</xsl:call-template>
|
118
124
|
<fo:layout-master-set>
|
119
125
|
<!-- cover pages -->
|
120
126
|
<fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
|
@@ -930,14 +936,16 @@
|
|
930
936
|
<fo:inline keep-together.within-line="always" font-size="25pt" font-weight="bold" color="{$color_gray}" border-bottom="0.5pt solid {$color_gray}" padding-bottom="3.5mm" baseline-shift="5.5mm"><fo:leader leader-pattern="space"/><xsl:value-of select="//iec:iec-standard/iec:bibdata/iec:docidentifier[@type = 'iso' or @type = 'ISO']"/></fo:inline>
|
931
937
|
</fo:block>
|
932
938
|
<fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
|
933
|
-
<xsl:
|
934
|
-
<xsl:
|
935
|
-
<xsl:
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
+
<xsl:call-template name="capitalize">
|
940
|
+
<xsl:with-param name="str">
|
941
|
+
<xsl:call-template name="getLocalizedString">
|
942
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
943
|
+
</xsl:call-template>
|
944
|
+
</xsl:with-param>
|
945
|
+
</xsl:call-template>
|
946
|
+
<xsl:text> </xsl:text>
|
939
947
|
<fo:inline>
|
940
|
-
<xsl:variable name="edition" select="//iec:iec-standard/iec:bibdata/iec:edition"/>
|
948
|
+
<xsl:variable name="edition" select="//iec:iec-standard/iec:bibdata/iec:edition[normalize-space(@language) = '']"/>
|
941
949
|
<xsl:value-of select="$edition"/>
|
942
950
|
<xsl:if test="not(contains($edition, '.'))">.0</xsl:if>
|
943
951
|
</fo:inline>
|
@@ -1922,7 +1930,7 @@
|
|
1922
1930
|
</xsl:copy>
|
1923
1931
|
</xsl:template> -->
|
1924
1932
|
|
1925
|
-
<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">
|
1933
|
+
<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">
|
1926
1934
|
<xsl:call-template name="getLang"/>
|
1927
1935
|
</xsl:variable><xsl:variable name="pageWidth_">
|
1928
1936
|
210
|
@@ -1937,20 +1945,7 @@
|
|
1937
1945
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
1938
1946
|
15
|
1939
1947
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
1940
|
-
|
1941
|
-
<title-edition lang="en">
|
1942
|
-
|
1943
|
-
<xsl:text>Edition </xsl:text>
|
1944
|
-
|
1945
|
-
</title-edition>
|
1946
1948
|
|
1947
|
-
<title-edition lang="fr">
|
1948
|
-
<xsl:text>Édition </xsl:text>
|
1949
|
-
</title-edition>
|
1950
|
-
|
1951
|
-
<title-edition lang="ru">
|
1952
|
-
<xsl:text>Издание </xsl:text>
|
1953
|
-
</title-edition>
|
1954
1949
|
|
1955
1950
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
1956
1951
|
<title-toc lang="en">
|
@@ -2035,7 +2030,7 @@
|
|
2035
2030
|
</xsl:variable><xsl:variable name="bibdata">
|
2036
2031
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
2037
2032
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
2038
|
-
</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">
|
2033
|
+
</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">
|
2039
2034
|
<xsl:param name="name"/>
|
2040
2035
|
<xsl:param name="lang"/>
|
2041
2036
|
<xsl:variable name="lang_">
|
@@ -2078,7 +2073,30 @@
|
|
2078
2073
|
|
2079
2074
|
|
2080
2075
|
|
2081
|
-
</xsl:attribute-set><xsl:
|
2076
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
2077
|
+
<xsl:param name="root-style"/>
|
2078
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
2079
|
+
|
2080
|
+
<xsl:variable name="additional_fonts_">
|
2081
|
+
<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']">
|
2082
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
2083
|
+
</xsl:for-each>
|
2084
|
+
</xsl:variable>
|
2085
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
2086
|
+
|
2087
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
2088
|
+
<xsl:choose>
|
2089
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
2090
|
+
<xsl:attribute name="{local-name()}">
|
2091
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
2092
|
+
</xsl:attribute>
|
2093
|
+
</xsl:when>
|
2094
|
+
<xsl:otherwise>
|
2095
|
+
<xsl:copy-of select="."/>
|
2096
|
+
</xsl:otherwise>
|
2097
|
+
</xsl:choose>
|
2098
|
+
</xsl:for-each>
|
2099
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
2082
2100
|
|
2083
2101
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
2084
2102
|
|
@@ -2136,7 +2154,6 @@
|
|
2136
2154
|
|
2137
2155
|
|
2138
2156
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
2139
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
2140
2157
|
|
2141
2158
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
2142
2159
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -2224,6 +2241,7 @@
|
|
2224
2241
|
<xsl:attribute name="margin-left">10mm</xsl:attribute>
|
2225
2242
|
|
2226
2243
|
|
2244
|
+
|
2227
2245
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
2228
2246
|
|
2229
2247
|
|
@@ -2620,7 +2638,7 @@
|
|
2620
2638
|
|
2621
2639
|
|
2622
2640
|
|
2623
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2641
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2624
2642
|
|
2625
2643
|
|
2626
2644
|
|
@@ -3343,10 +3361,41 @@
|
|
3343
3361
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3344
3362
|
<xsl:apply-templates select="."/>
|
3345
3363
|
</xsl:for-each>
|
3346
|
-
</xsl:template><xsl:template match="text()">
|
3347
|
-
|
3364
|
+
</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">
|
3365
|
+
|
3366
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3367
|
+
<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))"/>
|
3368
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3369
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3370
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3371
|
+
<xsl:with-param name="text" select="$text"/>
|
3372
|
+
</xsl:call-template>
|
3373
|
+
|
3374
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
3375
|
+
<xsl:param name="tag_open"/>
|
3376
|
+
<xsl:param name="tag_close"/>
|
3377
|
+
<xsl:param name="text"/>
|
3378
|
+
<xsl:choose>
|
3379
|
+
<xsl:when test="contains($text, $tag_open)">
|
3380
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3381
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
3382
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3383
|
+
<fo:inline keep-together.within-line="always">
|
3384
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3385
|
+
</fo:inline>
|
3386
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
3387
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3388
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
3389
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
3390
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3391
|
+
</xsl:call-template>
|
3392
|
+
</xsl:when>
|
3393
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
3394
|
+
</xsl:choose>
|
3348
3395
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3349
3396
|
<xsl:value-of select="$linebreak"/>
|
3397
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
3398
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3350
3399
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
3351
3400
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
3352
3401
|
<xsl:apply-templates/>
|
@@ -3415,8 +3464,23 @@
|
|
3415
3464
|
</fo:block>
|
3416
3465
|
|
3417
3466
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
3418
|
-
|
3419
|
-
|
3467
|
+
<xsl:choose>
|
3468
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
3469
|
+
<xsl:value-of select="."/>
|
3470
|
+
</xsl:when>
|
3471
|
+
<xsl:otherwise>
|
3472
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
3473
|
+
</xsl:otherwise>
|
3474
|
+
</xsl:choose>
|
3475
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
3476
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
3477
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
3478
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
3479
|
+
<xsl:choose>
|
3480
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
3481
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
3482
|
+
</xsl:choose>
|
3483
|
+
</xsl:for-each>
|
3420
3484
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3421
3485
|
|
3422
3486
|
<xsl:variable name="table-preamble">
|
@@ -3544,16 +3608,9 @@
|
|
3544
3608
|
</xsl:for-each>
|
3545
3609
|
</xsl:when>
|
3546
3610
|
<xsl:otherwise>
|
3547
|
-
<xsl:
|
3548
|
-
<xsl:
|
3549
|
-
|
3550
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3551
|
-
</xsl:when>
|
3552
|
-
<xsl:otherwise>
|
3553
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3554
|
-
</xsl:otherwise>
|
3555
|
-
</xsl:choose>
|
3556
|
-
</xsl:for-each>
|
3611
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3612
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3613
|
+
</xsl:call-template>
|
3557
3614
|
</xsl:otherwise>
|
3558
3615
|
</xsl:choose>
|
3559
3616
|
|
@@ -3717,6 +3774,7 @@
|
|
3717
3774
|
<xsl:with-param name="text" select="$td_text"/>
|
3718
3775
|
</xsl:call-template>
|
3719
3776
|
</xsl:variable>
|
3777
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
3720
3778
|
<xsl:call-template name="tokenize">
|
3721
3779
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
3722
3780
|
<!-- 2009 thinspace -->
|
@@ -3729,6 +3787,7 @@
|
|
3729
3787
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3730
3788
|
</xsl:call-template>
|
3731
3789
|
</xsl:variable>
|
3790
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
3732
3791
|
<width>
|
3733
3792
|
<xsl:variable name="divider">
|
3734
3793
|
<xsl:choose>
|
@@ -3761,6 +3820,10 @@
|
|
3761
3820
|
<xsl:with-param name="table" select="$table"/>
|
3762
3821
|
</xsl:call-template>
|
3763
3822
|
</xsl:if>
|
3823
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
|
3824
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
3825
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
3826
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
3764
3827
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
3765
3828
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
3766
3829
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
@@ -3862,16 +3925,9 @@
|
|
3862
3925
|
</xsl:for-each>
|
3863
3926
|
</xsl:when>
|
3864
3927
|
<xsl:otherwise>
|
3865
|
-
<xsl:
|
3866
|
-
<xsl:
|
3867
|
-
|
3868
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3869
|
-
</xsl:when>
|
3870
|
-
<xsl:otherwise>
|
3871
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3872
|
-
</xsl:otherwise>
|
3873
|
-
</xsl:choose>
|
3874
|
-
</xsl:for-each>
|
3928
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3929
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3930
|
+
</xsl:call-template>
|
3875
3931
|
</xsl:otherwise>
|
3876
3932
|
</xsl:choose>
|
3877
3933
|
|
@@ -4438,8 +4494,10 @@
|
|
4438
4494
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
4439
4495
|
</xsl:variable>
|
4440
4496
|
|
4497
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
4498
|
+
|
4441
4499
|
<xsl:choose>
|
4442
|
-
<xsl:when test="$
|
4500
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
4443
4501
|
|
4444
4502
|
<fo:block text-align="left">
|
4445
4503
|
|
@@ -4461,7 +4519,7 @@
|
|
4461
4519
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
4462
4520
|
</fo:block>
|
4463
4521
|
|
4464
|
-
</xsl:when>
|
4522
|
+
</xsl:when> <!-- END: only one component -->
|
4465
4523
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4466
4524
|
<fo:block margin-bottom="12pt" text-align="left">
|
4467
4525
|
|
@@ -4477,8 +4535,8 @@
|
|
4477
4535
|
</xsl:variable>
|
4478
4536
|
<xsl:value-of select="$title-where"/>
|
4479
4537
|
</fo:block>
|
4480
|
-
</xsl:when>
|
4481
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
4538
|
+
</xsl:when> <!-- END: a few components -->
|
4539
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
4482
4540
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
4483
4541
|
|
4484
4542
|
|
@@ -4494,11 +4552,11 @@
|
|
4494
4552
|
</xsl:variable>
|
4495
4553
|
<xsl:value-of select="$title-key"/>
|
4496
4554
|
</fo:block>
|
4497
|
-
</xsl:when>
|
4555
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
4498
4556
|
</xsl:choose>
|
4499
4557
|
|
4500
4558
|
<!-- a few components -->
|
4501
|
-
<xsl:if test="
|
4559
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
4502
4560
|
<fo:block>
|
4503
4561
|
|
4504
4562
|
|
@@ -4539,21 +4597,28 @@
|
|
4539
4597
|
<xsl:apply-templates mode="dl"/>
|
4540
4598
|
</tbody>
|
4541
4599
|
</xsl:variable>
|
4542
|
-
<!-- html-table<xsl:copy-of select="$html-table"/> -->
|
4600
|
+
<!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
|
4543
4601
|
<xsl:variable name="colwidths">
|
4544
4602
|
<xsl:call-template name="calculate-column-widths">
|
4545
4603
|
<xsl:with-param name="cols-count" select="2"/>
|
4546
4604
|
<xsl:with-param name="table" select="$html-table"/>
|
4547
4605
|
</xsl:call-template>
|
4548
4606
|
</xsl:variable>
|
4549
|
-
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4607
|
+
<!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4550
4608
|
<xsl:variable name="maxlength_dt">
|
4551
4609
|
<xsl:call-template name="getMaxLength_dt"/>
|
4552
4610
|
</xsl:variable>
|
4611
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
4612
|
+
false
|
4613
|
+
</xsl:variable>
|
4614
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
4615
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
4553
4616
|
<xsl:call-template name="setColumnWidth_dl">
|
4554
4617
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4555
4618
|
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4619
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
4556
4620
|
</xsl:call-template>
|
4621
|
+
|
4557
4622
|
<fo:table-body>
|
4558
4623
|
<xsl:apply-templates>
|
4559
4624
|
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
@@ -4562,12 +4627,13 @@
|
|
4562
4627
|
</fo:table>
|
4563
4628
|
</fo:block>
|
4564
4629
|
</fo:block>
|
4565
|
-
</xsl:if>
|
4630
|
+
</xsl:if> <!-- END: a few components -->
|
4566
4631
|
</fo:block-container>
|
4567
4632
|
</fo:block-container>
|
4568
4633
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
4569
4634
|
<xsl:param name="colwidths"/>
|
4570
4635
|
<xsl:param name="maxlength_dt"/>
|
4636
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
4571
4637
|
<xsl:choose>
|
4572
4638
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
4573
4639
|
<fo:table-column column-width="50%"/>
|
@@ -4575,6 +4641,11 @@
|
|
4575
4641
|
</xsl:when>
|
4576
4642
|
<xsl:otherwise>
|
4577
4643
|
<xsl:choose>
|
4644
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
4645
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4646
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4647
|
+
</xsl:call-template>
|
4648
|
+
</xsl:when>
|
4578
4649
|
<!-- to set width check most wide chars like `W` -->
|
4579
4650
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
4580
4651
|
<fo:table-column column-width="7%"/>
|
@@ -4605,20 +4676,25 @@
|
|
4605
4676
|
<fo:table-column column-width="60%"/>
|
4606
4677
|
</xsl:when>
|
4607
4678
|
<xsl:otherwise>
|
4608
|
-
<xsl:
|
4609
|
-
<xsl:
|
4610
|
-
|
4611
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
4612
|
-
</xsl:when>
|
4613
|
-
<xsl:otherwise>
|
4614
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4615
|
-
</xsl:otherwise>
|
4616
|
-
</xsl:choose>
|
4617
|
-
</xsl:for-each>
|
4679
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4680
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4681
|
+
</xsl:call-template>
|
4618
4682
|
</xsl:otherwise>
|
4619
4683
|
</xsl:choose>
|
4620
4684
|
</xsl:otherwise>
|
4621
4685
|
</xsl:choose>
|
4686
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
4687
|
+
<xsl:param name="colwidths"/>
|
4688
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
4689
|
+
<xsl:choose>
|
4690
|
+
<xsl:when test=". = 1 or . = 0">
|
4691
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
4692
|
+
</xsl:when>
|
4693
|
+
<xsl:otherwise>
|
4694
|
+
<fo:table-column column-width="proportional-column-width({.})"/>
|
4695
|
+
</xsl:otherwise>
|
4696
|
+
</xsl:choose>
|
4697
|
+
</xsl:for-each>
|
4622
4698
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
4623
4699
|
<xsl:variable name="lengths">
|
4624
4700
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -4642,7 +4718,6 @@
|
|
4642
4718
|
<xsl:value-of select="$maxLength"/>
|
4643
4719
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
4644
4720
|
<xsl:param name="key_iso"/>
|
4645
|
-
|
4646
4721
|
<!-- <tr>
|
4647
4722
|
<td>NOTE</td>
|
4648
4723
|
<td>
|
@@ -4650,18 +4725,30 @@
|
|
4650
4725
|
</td>
|
4651
4726
|
</tr>
|
4652
4727
|
-->
|
4653
|
-
|
4728
|
+
<!-- OLD Variant -->
|
4729
|
+
<!-- <fo:table-row>
|
4654
4730
|
<fo:table-cell>
|
4655
4731
|
<fo:block margin-top="6pt">
|
4656
4732
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4657
4733
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4658
4734
|
</xsl:if>
|
4659
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
4735
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
4660
4736
|
</fo:block>
|
4661
4737
|
</fo:table-cell>
|
4662
4738
|
<fo:table-cell>
|
4663
4739
|
<fo:block>
|
4664
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
4740
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
4741
|
+
</fo:block>
|
4742
|
+
</fo:table-cell>
|
4743
|
+
</fo:table-row> -->
|
4744
|
+
<!-- <tr>
|
4745
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
4746
|
+
</tr>
|
4747
|
+
-->
|
4748
|
+
<fo:table-row>
|
4749
|
+
<fo:table-cell number-columns-spanned="2">
|
4750
|
+
<fo:block>
|
4751
|
+
<xsl:call-template name="note"/>
|
4665
4752
|
</fo:block>
|
4666
4753
|
</fo:table-cell>
|
4667
4754
|
</fo:table-row>
|
@@ -4763,13 +4850,15 @@
|
|
4763
4850
|
<xsl:choose>
|
4764
4851
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4765
4852
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4766
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4853
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4767
4854
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4768
4855
|
</xsl:choose>
|
4769
4856
|
</xsl:attribute>
|
4770
4857
|
</xsl:if>
|
4771
4858
|
<xsl:apply-templates/>
|
4772
4859
|
</fo:inline>
|
4860
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4861
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
4773
4862
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
4774
4863
|
<fo:inline text-decoration="underline">
|
4775
4864
|
<xsl:apply-templates/>
|
@@ -4917,41 +5006,50 @@
|
|
4917
5006
|
<fo:block break-after="page"/>
|
4918
5007
|
<fo:block> </fo:block>
|
4919
5008
|
<fo:block break-after="page"/>
|
5009
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
5010
|
+
<xsl:apply-templates/>
|
4920
5011
|
</xsl:template><xsl:template name="tokenize">
|
4921
5012
|
<xsl:param name="text"/>
|
4922
5013
|
<xsl:param name="separator" select="' '"/>
|
4923
5014
|
<xsl:choose>
|
4924
5015
|
<xsl:when test="not(contains($text, $separator))">
|
4925
5016
|
<word>
|
4926
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4927
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4928
5017
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
4929
|
-
<xsl:variable name="len_str">
|
4930
|
-
<xsl:choose>
|
4931
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4932
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4933
|
-
</xsl:when>
|
4934
|
-
<xsl:otherwise>
|
4935
|
-
<xsl:value-of select="$len_str_tmp"/>
|
4936
|
-
</xsl:otherwise>
|
4937
|
-
</xsl:choose>
|
4938
|
-
</xsl:variable>
|
4939
|
-
|
4940
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4941
|
-
<xsl:message>
|
4942
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4943
|
-
len_str=<xsl:value-of select="$len_str"/>
|
4944
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4945
|
-
</xsl:message>
|
4946
|
-
</xsl:if> -->
|
4947
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4948
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4949
5018
|
<xsl:choose>
|
4950
|
-
<xsl:when test="$
|
4951
|
-
<xsl:value-of select="$
|
5019
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
5020
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4952
5021
|
</xsl:when>
|
4953
5022
|
<xsl:otherwise>
|
4954
|
-
<xsl:
|
5023
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5024
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5025
|
+
<xsl:variable name="len_str">
|
5026
|
+
<xsl:choose>
|
5027
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5028
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5029
|
+
</xsl:when>
|
5030
|
+
<xsl:otherwise>
|
5031
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5032
|
+
</xsl:otherwise>
|
5033
|
+
</xsl:choose>
|
5034
|
+
</xsl:variable>
|
5035
|
+
|
5036
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5037
|
+
<xsl:message>
|
5038
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5039
|
+
len_str=<xsl:value-of select="$len_str"/>
|
5040
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5041
|
+
</xsl:message>
|
5042
|
+
</xsl:if> -->
|
5043
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5044
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5045
|
+
<xsl:choose>
|
5046
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
5047
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
5048
|
+
</xsl:when>
|
5049
|
+
<xsl:otherwise>
|
5050
|
+
<xsl:value-of select="$len_str"/>
|
5051
|
+
</xsl:otherwise>
|
5052
|
+
</xsl:choose>
|
4955
5053
|
</xsl:otherwise>
|
4956
5054
|
</xsl:choose>
|
4957
5055
|
</word>
|
@@ -5037,24 +5135,28 @@
|
|
5037
5135
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
5038
5136
|
<xsl:param name="text" select="."/>
|
5039
5137
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
5138
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
5040
5139
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
5140
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
5041
5141
|
<xsl:variable name="zero-space"></xsl:variable>
|
5042
5142
|
<xsl:choose>
|
5043
5143
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
5044
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
5144
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
5045
5145
|
<xsl:value-of select="$zero-space-after-equals"/>
|
5046
5146
|
<xsl:value-of select="$zero-space"/>
|
5047
5147
|
<xsl:call-template name="add-zero-spaces-equal">
|
5048
5148
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
5049
|
-
</xsl:call-template>
|
5149
|
+
</xsl:call-template> -->
|
5150
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
5050
5151
|
</xsl:when>
|
5051
5152
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
5052
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
5153
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
5053
5154
|
<xsl:value-of select="$zero-space-after-equal"/>
|
5054
5155
|
<xsl:value-of select="$zero-space"/>
|
5055
5156
|
<xsl:call-template name="add-zero-spaces-equal">
|
5056
5157
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
5057
|
-
</xsl:call-template>
|
5158
|
+
</xsl:call-template> -->
|
5159
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
5058
5160
|
</xsl:when>
|
5059
5161
|
<xsl:otherwise>
|
5060
5162
|
<xsl:value-of select="$text"/>
|
@@ -5222,6 +5324,9 @@
|
|
5222
5324
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
5223
5325
|
|
5224
5326
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
5327
|
+
|
5328
|
+
|
5329
|
+
|
5225
5330
|
|
5226
5331
|
|
5227
5332
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -5229,48 +5334,80 @@
|
|
5229
5334
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5230
5335
|
</xsl:call-template>
|
5231
5336
|
|
5337
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
5338
|
+
<!-- insert helper tag -->
|
5339
|
+
<!-- set unique font-size (fiction) -->
|
5340
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
5341
|
+
<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 -->
|
5342
|
+
</xsl:if>
|
5232
5343
|
|
5233
|
-
|
5234
|
-
|
5235
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
5344
|
+
<xsl:variable name="mathml_content">
|
5345
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5236
5346
|
</xsl:variable>
|
5237
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
5238
5347
|
|
5348
|
+
|
5349
|
+
<xsl:call-template name="mathml_instream_object">
|
5350
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
5351
|
+
</xsl:call-template>
|
5239
5352
|
|
5240
|
-
|
5241
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5242
|
-
<xsl:variable name="comment_text_">
|
5243
|
-
<xsl:choose>
|
5244
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5245
|
-
<xsl:value-of select="$comment_text_following"/>
|
5246
|
-
</xsl:when>
|
5247
|
-
<xsl:otherwise>
|
5248
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5249
|
-
</xsl:otherwise>
|
5250
|
-
</xsl:choose>
|
5251
|
-
</xsl:variable>
|
5252
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5253
|
-
|
5254
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
5255
|
-
<!-- put Mathin Alternate Text -->
|
5256
|
-
<xsl:attribute name="fox:alt-text">
|
5257
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
5258
|
-
</xsl:attribute>
|
5259
|
-
</xsl:if>
|
5260
|
-
|
5261
|
-
<xsl:variable name="mathml_content">
|
5262
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5263
|
-
</xsl:variable>
|
5264
|
-
<!-- put MathML in Actual Text -->
|
5265
|
-
<xsl:attribute name="fox:actual-text">
|
5266
|
-
<xsl:value-of select="$mathml_content"/>
|
5267
|
-
</xsl:attribute>
|
5268
|
-
|
5269
|
-
|
5270
|
-
|
5271
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5272
|
-
</fo:instream-foreign-object>
|
5353
|
+
|
5273
5354
|
</fo:inline>
|
5355
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
5356
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5357
|
+
<xsl:variable name="comment_text_">
|
5358
|
+
<xsl:choose>
|
5359
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5360
|
+
<xsl:value-of select="$comment_text_following"/>
|
5361
|
+
</xsl:when>
|
5362
|
+
<xsl:otherwise>
|
5363
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5364
|
+
</xsl:otherwise>
|
5365
|
+
</xsl:choose>
|
5366
|
+
</xsl:variable>
|
5367
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5368
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
5369
|
+
<xsl:value-of select="$comment_text"/>
|
5370
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
5371
|
+
<xsl:param name="comment_text"/>
|
5372
|
+
<xsl:param name="mathml_content"/>
|
5373
|
+
|
5374
|
+
<xsl:variable name="comment_text_">
|
5375
|
+
<xsl:choose>
|
5376
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
5377
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
5378
|
+
</xsl:choose>
|
5379
|
+
</xsl:variable>
|
5380
|
+
|
5381
|
+
<xsl:variable name="mathml">
|
5382
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
5383
|
+
</xsl:variable>
|
5384
|
+
|
5385
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
5386
|
+
|
5387
|
+
|
5388
|
+
|
5389
|
+
|
5390
|
+
|
5391
|
+
|
5392
|
+
|
5393
|
+
<!-- put MathML in Actual Text -->
|
5394
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
5395
|
+
<xsl:attribute name="fox:actual-text">
|
5396
|
+
<xsl:value-of select="$mathml_content"/>
|
5397
|
+
</xsl:attribute>
|
5398
|
+
|
5399
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
5400
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
5401
|
+
<!-- put Mathin Alternate Text -->
|
5402
|
+
<xsl:attribute name="fox:alt-text">
|
5403
|
+
<xsl:value-of select="$comment_text_"/>
|
5404
|
+
</xsl:attribute>
|
5405
|
+
</xsl:if>
|
5406
|
+
<!-- </xsl:if> -->
|
5407
|
+
|
5408
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5409
|
+
|
5410
|
+
</fo:instream-foreign-object>
|
5274
5411
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
5275
5412
|
<!-- <xsl:text>a+b</xsl:text> -->
|
5276
5413
|
<xsl:text><</xsl:text>
|
@@ -5301,7 +5438,9 @@
|
|
5301
5438
|
<!-- replace start and end spaces to non-break space -->
|
5302
5439
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
5303
5440
|
</xsl:copy>
|
5304
|
-
</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="
|
5441
|
+
</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">
|
5442
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
5443
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
5305
5444
|
<xsl:variable name="target">
|
5306
5445
|
<xsl:choose>
|
5307
5446
|
<xsl:when test="@updatetype = 'true'">
|
@@ -5534,7 +5673,12 @@
|
|
5534
5673
|
|
5535
5674
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
5536
5675
|
|
5676
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
5677
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
5678
|
+
</xsl:if>
|
5679
|
+
|
5537
5680
|
|
5681
|
+
|
5538
5682
|
|
5539
5683
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
5540
5684
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -5893,18 +6037,33 @@
|
|
5893
6037
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
5894
6038
|
<xsl:copy>
|
5895
6039
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
5896
|
-
<xsl:variable name="
|
6040
|
+
<xsl:variable name="viewbox_">
|
5897
6041
|
<xsl:call-template name="split">
|
5898
6042
|
<xsl:with-param name="pText" select="@viewBox"/>
|
5899
6043
|
<xsl:with-param name="sep" select="' '"/>
|
5900
6044
|
</xsl:call-template>
|
5901
6045
|
</xsl:variable>
|
6046
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
6047
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
6048
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
6049
|
+
|
5902
6050
|
<xsl:attribute name="width">
|
5903
|
-
<xsl:
|
6051
|
+
<xsl:choose>
|
6052
|
+
<xsl:when test="$width != ''">
|
6053
|
+
<xsl:value-of select="round($width)"/>
|
6054
|
+
</xsl:when>
|
6055
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
6056
|
+
</xsl:choose>
|
5904
6057
|
</xsl:attribute>
|
5905
6058
|
<xsl:attribute name="height">
|
5906
|
-
<xsl:
|
6059
|
+
<xsl:choose>
|
6060
|
+
<xsl:when test="$height != ''">
|
6061
|
+
<xsl:value-of select="round($height)"/>
|
6062
|
+
</xsl:when>
|
6063
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
6064
|
+
</xsl:choose>
|
5907
6065
|
</xsl:attribute>
|
6066
|
+
|
5908
6067
|
<xsl:apply-templates mode="svg_update"/>
|
5909
6068
|
</xsl:copy>
|
5910
6069
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -6099,7 +6258,11 @@
|
|
6099
6258
|
<xsl:apply-templates mode="bookmarks"/>
|
6100
6259
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
6101
6260
|
<xsl:apply-templates select="."/>
|
6102
|
-
</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() = '
|
6261
|
+
</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">
|
6262
|
+
<xsl:apply-templates mode="contents"/>
|
6263
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
6264
|
+
<xsl:apply-templates mode="bookmarks"/>
|
6265
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
6103
6266
|
<xsl:apply-templates mode="bookmarks"/>
|
6104
6267
|
</xsl:template><xsl:template name="addBookmarks">
|
6105
6268
|
<xsl:param name="contents"/>
|
@@ -6390,7 +6553,9 @@
|
|
6390
6553
|
<xsl:apply-templates/>
|
6391
6554
|
</xsl:otherwise>
|
6392
6555
|
</xsl:choose>
|
6393
|
-
</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() = '
|
6556
|
+
</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">
|
6557
|
+
<xsl:value-of select="."/>
|
6558
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
6394
6559
|
<xsl:text> </xsl:text>
|
6395
6560
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
6396
6561
|
<xsl:copy>
|
@@ -6421,9 +6586,22 @@
|
|
6421
6586
|
</xsl:when>
|
6422
6587
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
6423
6588
|
</xsl:choose>
|
6589
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6590
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6591
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6592
|
+
<xsl:apply-templates mode="contents_item"/>
|
6424
6593
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
6425
6594
|
|
6426
6595
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6596
|
+
|
6597
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6598
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6599
|
+
</xsl:if>
|
6600
|
+
|
6601
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6602
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6603
|
+
</xsl:if>
|
6604
|
+
|
6427
6605
|
<xsl:copy-of select="@id"/>
|
6428
6606
|
|
6429
6607
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -6523,17 +6701,15 @@
|
|
6523
6701
|
|
6524
6702
|
<!-- split text by zero-width space -->
|
6525
6703
|
<xsl:variable name="text_step4">
|
6526
|
-
<xsl:call-template name="
|
6704
|
+
<xsl:call-template name="split_for_interspers">
|
6527
6705
|
<xsl:with-param name="pText" select="$text_step3"/>
|
6528
6706
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
6529
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
6530
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
6531
6707
|
</xsl:call-template>
|
6532
6708
|
</xsl:variable>
|
6533
6709
|
|
6534
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
6710
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
6535
6711
|
<xsl:choose>
|
6536
|
-
<xsl:when test="
|
6712
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
6537
6713
|
<xsl:call-template name="interspers">
|
6538
6714
|
<xsl:with-param name="str" select="."/>
|
6539
6715
|
</xsl:call-template>
|
@@ -6544,6 +6720,30 @@
|
|
6544
6720
|
</xsl:choose>
|
6545
6721
|
</xsl:for-each>
|
6546
6722
|
|
6723
|
+
</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">
|
6724
|
+
<xsl:param name="pText" select="."/>
|
6725
|
+
<xsl:param name="sep" select="','"/>
|
6726
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
6727
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
6728
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
6729
|
+
<xsl:call-template name="replace_tag_interspers">
|
6730
|
+
<xsl:with-param name="text" select="$text"/>
|
6731
|
+
</xsl:call-template>
|
6732
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
6733
|
+
<xsl:param name="text"/>
|
6734
|
+
<xsl:choose>
|
6735
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
6736
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
6737
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
6738
|
+
<interspers>
|
6739
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
6740
|
+
</interspers>
|
6741
|
+
<xsl:call-template name="replace_tag_interspers">
|
6742
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
6743
|
+
</xsl:call-template>
|
6744
|
+
</xsl:when>
|
6745
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
6746
|
+
</xsl:choose>
|
6547
6747
|
</xsl:template><xsl:template name="interspers">
|
6548
6748
|
<xsl:param name="str"/>
|
6549
6749
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -6879,11 +7079,13 @@
|
|
6879
7079
|
</xsl:otherwise>
|
6880
7080
|
</xsl:choose>
|
6881
7081
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
6882
|
-
|
6883
|
-
|
7082
|
+
|
7083
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
7084
|
+
|
6884
7085
|
|
7086
|
+
|
6885
7087
|
<xsl:variable name="fo_element">
|
6886
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
7088
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
6887
7089
|
|
6888
7090
|
<xsl:choose>
|
6889
7091
|
<!-- if example contains only one (except 'name') element (paragraph for example), then display it on the same line as EXAMPLE title -->
|
@@ -6893,31 +7095,57 @@
|
|
6893
7095
|
|
6894
7096
|
</xsl:variable>
|
6895
7097
|
|
6896
|
-
|
6897
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
6898
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6899
|
-
</xsl:apply-templates>
|
7098
|
+
<fo:block-container margin-left="0mm">
|
6900
7099
|
|
6901
|
-
|
6902
|
-
|
6903
|
-
<
|
6904
|
-
|
6905
|
-
|
7100
|
+
<xsl:choose>
|
7101
|
+
|
7102
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
7103
|
+
|
7104
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
7105
|
+
<fo:block>
|
7106
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6906
7107
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6907
7108
|
</xsl:apply-templates>
|
7109
|
+
</fo:block>
|
7110
|
+
|
7111
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7112
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7113
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
7114
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7115
|
+
</xsl:apply-templates>
|
7116
|
+
</fo:block-container>
|
6908
7117
|
</fo:block-container>
|
6909
|
-
</
|
6910
|
-
|
6911
|
-
|
6912
|
-
|
6913
|
-
|
6914
|
-
|
6915
|
-
|
6916
|
-
|
6917
|
-
|
6918
|
-
|
6919
|
-
|
6920
|
-
|
7118
|
+
</xsl:when> <!-- end block -->
|
7119
|
+
|
7120
|
+
<xsl:otherwise> <!-- inline -->
|
7121
|
+
|
7122
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
7123
|
+
<fo:block>
|
7124
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
7125
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7126
|
+
</xsl:apply-templates>
|
7127
|
+
<fo:inline>
|
7128
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
7129
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7130
|
+
</xsl:apply-templates>
|
7131
|
+
</fo:inline>
|
7132
|
+
</fo:block>
|
7133
|
+
|
7134
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
7135
|
+
<!-- display further elements in blocks -->
|
7136
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7137
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7138
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
7139
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
7140
|
+
</xsl:apply-templates>
|
7141
|
+
</fo:block-container>
|
7142
|
+
</fo:block-container>
|
7143
|
+
</xsl:if>
|
7144
|
+
</xsl:otherwise> <!-- end inline -->
|
7145
|
+
|
7146
|
+
</xsl:choose>
|
7147
|
+
</fo:block-container>
|
7148
|
+
</fo:block-container>
|
6921
7149
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
6922
7150
|
<xsl:param name="fo_element">block</xsl:param>
|
6923
7151
|
|
@@ -6949,10 +7177,16 @@
|
|
6949
7177
|
</xsl:variable>
|
6950
7178
|
<xsl:choose>
|
6951
7179
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
6952
|
-
<fo:block
|
6953
|
-
|
6954
|
-
|
6955
|
-
|
7180
|
+
<fo:block-container>
|
7181
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
7182
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7183
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7184
|
+
</xsl:if>
|
7185
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
7186
|
+
|
7187
|
+
<xsl:apply-templates/>
|
7188
|
+
</fo:block>
|
7189
|
+
</fo:block-container>
|
6956
7190
|
</xsl:when>
|
6957
7191
|
<xsl:otherwise>
|
6958
7192
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -6997,7 +7231,7 @@
|
|
6997
7231
|
</xsl:otherwise>
|
6998
7232
|
</xsl:choose> -->
|
6999
7233
|
</fo:block>
|
7000
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
7234
|
+
</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">
|
7001
7235
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
7002
7236
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
7003
7237
|
<xsl:if test="normalize-space() != ''">
|
@@ -7033,7 +7267,8 @@
|
|
7033
7267
|
<fo:inline><xsl:apply-templates/></fo:inline>
|
7034
7268
|
</xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
|
7035
7269
|
<xsl:if test="normalize-space() != ''">
|
7036
|
-
<xsl:value-of select="."/>
|
7270
|
+
<!-- <xsl:value-of select="."/> -->
|
7271
|
+
<xsl:call-template name="text"/>
|
7037
7272
|
</xsl:if>
|
7038
7273
|
</xsl:template><xsl:template match="*[local-name() = 'quote']">
|
7039
7274
|
<fo:block-container margin-left="0mm">
|
@@ -7130,7 +7365,16 @@
|
|
7130
7365
|
</fo:inline>
|
7131
7366
|
</xsl:when>
|
7132
7367
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
7133
|
-
|
7368
|
+
|
7369
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
7370
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
7371
|
+
<xsl:choose>
|
7372
|
+
<xsl:when test="$uri_src != ''">
|
7373
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
7374
|
+
</xsl:when>
|
7375
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
7376
|
+
</xsl:choose>
|
7377
|
+
|
7134
7378
|
</xsl:otherwise>
|
7135
7379
|
</xsl:choose>
|
7136
7380
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -7307,10 +7551,24 @@
|
|
7307
7551
|
|
7308
7552
|
</fo:block>
|
7309
7553
|
<xsl:apply-templates/>
|
7310
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7554
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
7311
7555
|
<!-- comment 2019-11-29 -->
|
7312
7556
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
7313
7557
|
<xsl:apply-templates /> -->
|
7558
|
+
|
7559
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7560
|
+
|
7561
|
+
<xsl:choose>
|
7562
|
+
<!-- if there isn't the attribute '@from', then -->
|
7563
|
+
<xsl:when test="$id_from = ''">
|
7564
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7565
|
+
</xsl:when>
|
7566
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7567
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7568
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7569
|
+
</xsl:when>
|
7570
|
+
</xsl:choose>
|
7571
|
+
|
7314
7572
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
7315
7573
|
<!-- 0xA0 to space replacement -->
|
7316
7574
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -7676,7 +7934,10 @@
|
|
7676
7934
|
<!-- to split by '_' and other chars -->
|
7677
7935
|
<xsl:call-template name="add-zero-spaces-java"/>
|
7678
7936
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
7679
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7937
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7938
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7939
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7940
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
|
7680
7941
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
7681
7942
|
<!-- <row>
|
7682
7943
|
<date>05-07-2013</date>
|
@@ -8222,6 +8483,120 @@
|
|
8222
8483
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8223
8484
|
</xsl:for-each>
|
8224
8485
|
</xsl:copy>
|
8486
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
8487
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
8488
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
8489
|
+
<xsl:copy>
|
8490
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
8491
|
+
</xsl:copy>
|
8492
|
+
</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">
|
8493
|
+
|
8494
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
8495
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
8496
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8497
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8498
|
+
<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))"/>
|
8499
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
8500
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8501
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8502
|
+
<xsl:with-param name="text" select="$text_"/>
|
8503
|
+
</xsl:call-template></text></xsl:variable>
|
8504
|
+
|
8505
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
8506
|
+
|
8507
|
+
<xsl:variable name="text2">
|
8508
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
8509
|
+
<xsl:copy-of select="."/>
|
8510
|
+
</xsl:for-each></text>
|
8511
|
+
</xsl:variable>
|
8512
|
+
|
8513
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
8514
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
8515
|
+
<xsl:variable name="text3">
|
8516
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
8517
|
+
<xsl:choose>
|
8518
|
+
<xsl:when test="self::text()">
|
8519
|
+
<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))"/>
|
8520
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8521
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8522
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8523
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8524
|
+
</xsl:call-template></text></xsl:variable>
|
8525
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8526
|
+
</xsl:when>
|
8527
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8528
|
+
</xsl:choose>
|
8529
|
+
</xsl:for-each></text>
|
8530
|
+
</xsl:variable>
|
8531
|
+
|
8532
|
+
<xsl:choose>
|
8533
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8534
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8535
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8536
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8537
|
+
<xsl:choose>
|
8538
|
+
<xsl:when test="self::text()">
|
8539
|
+
<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))"/>
|
8540
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8541
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8542
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8543
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8544
|
+
</xsl:call-template></text></xsl:variable>
|
8545
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8546
|
+
</xsl:when>
|
8547
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8548
|
+
</xsl:choose>
|
8549
|
+
</xsl:for-each>
|
8550
|
+
</xsl:when>
|
8551
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8552
|
+
</xsl:choose>
|
8553
|
+
|
8554
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8555
|
+
<xsl:param name="tag_open"/>
|
8556
|
+
<xsl:param name="tag_close"/>
|
8557
|
+
<xsl:param name="text"/>
|
8558
|
+
<xsl:choose>
|
8559
|
+
<xsl:when test="contains($text, $tag_open)">
|
8560
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8561
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8562
|
+
|
8563
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8564
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8565
|
+
</xsl:element>
|
8566
|
+
|
8567
|
+
<xsl:call-template name="replace_text_tags">
|
8568
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8569
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8570
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8571
|
+
</xsl:call-template>
|
8572
|
+
</xsl:when>
|
8573
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8574
|
+
</xsl:choose>
|
8575
|
+
</xsl:template><xsl:template name="printEdition">
|
8576
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8577
|
+
<xsl:text> </xsl:text>
|
8578
|
+
<xsl:choose>
|
8579
|
+
<xsl:when test="$edition_i18n != ''">
|
8580
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8581
|
+
<xsl:call-template name="capitalize">
|
8582
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8583
|
+
</xsl:call-template>
|
8584
|
+
</xsl:when>
|
8585
|
+
<xsl:otherwise>
|
8586
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8587
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8588
|
+
<xsl:call-template name="capitalize">
|
8589
|
+
<xsl:with-param name="str">
|
8590
|
+
<xsl:call-template name="getLocalizedString">
|
8591
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8592
|
+
</xsl:call-template>
|
8593
|
+
</xsl:with-param>
|
8594
|
+
</xsl:call-template>
|
8595
|
+
<xsl:text> </xsl:text>
|
8596
|
+
<xsl:value-of select="$edition"/>
|
8597
|
+
</xsl:if>
|
8598
|
+
</xsl:otherwise>
|
8599
|
+
</xsl:choose>
|
8225
8600
|
</xsl:template><xsl:template name="convertDate">
|
8226
8601
|
<xsl:param name="date"/>
|
8227
8602
|
<xsl:param name="format" select="'short'"/>
|