metanorma-itu 2.0.7 → 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/itu/html/html_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +1 -1
- data/lib/isodoc/itu/html_convert.rb +16 -11
- data/lib/isodoc/itu/init.rb +1 -1
- data/lib/isodoc/itu/itu.implementers-guide.xsl +554 -199
- data/lib/isodoc/itu/itu.in-force.xsl +554 -199
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +554 -199
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +554 -199
- data/lib/isodoc/itu/itu.recommendation.xsl +554 -199
- data/lib/isodoc/itu/itu.resolution.xsl +554 -199
- data/lib/isodoc/itu/itu.service-publication.xsl +554 -199
- data/lib/isodoc/itu/itu.technical-paper.xsl +554 -199
- data/lib/isodoc/itu/itu.technical-report.xsl +554 -199
- data/lib/isodoc/itu/presentation_xml_convert.rb +16 -0
- data/lib/isodoc/itu/ref.rb +20 -32
- data/lib/isodoc/itu/word_cleanup.rb +5 -3
- data/lib/isodoc/itu/xref.rb +42 -27
- data/lib/isodoc/itu/xref_section.rb +0 -15
- data/lib/metanorma/itu/biblio.rng +62 -10
- data/lib/metanorma/itu/isodoc.rng +56 -0
- data/lib/metanorma/itu/version.rb +1 -1
- data/lib/relaton/render/config.yml +3 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-itu.gemspec +1 -1
- metadata +6 -4
@@ -114,21 +114,29 @@
|
|
114
114
|
|
115
115
|
<xsl:template match="/">
|
116
116
|
<xsl:call-template name="namespaceCheck"/>
|
117
|
-
<fo:root
|
118
|
-
|
119
|
-
<xsl:attribute
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
117
|
+
<fo:root xml:lang="{$lang}">
|
118
|
+
<xsl:variable name="root-style">
|
119
|
+
<root-style xsl:use-attribute-sets="root-style">
|
120
|
+
<!-- <xsl:if test="$lang != 'ar'">
|
121
|
+
<xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
|
122
|
+
</xsl:if> -->
|
123
|
+
<xsl:if test="$doctype = 'resolution'">
|
124
|
+
<xsl:attribute name="font-size">11pt</xsl:attribute>
|
125
|
+
</xsl:if>
|
126
|
+
<xsl:if test="$doctype = 'service-publication'">
|
127
|
+
<xsl:attribute name="font-size">11pt</xsl:attribute>
|
128
|
+
<xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
|
129
|
+
</xsl:if>
|
130
|
+
<xsl:call-template name="setWritingMode"/>
|
131
|
+
<xsl:if test="$lang = 'ar'">
|
132
|
+
<xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
|
133
|
+
</xsl:if>
|
134
|
+
</root-style>
|
135
|
+
</xsl:variable>
|
136
|
+
<xsl:call-template name="insertRootStyle">
|
137
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
138
|
+
</xsl:call-template>
|
139
|
+
|
132
140
|
<fo:layout-master-set>
|
133
141
|
|
134
142
|
<!-- Technical Report first page -->
|
@@ -2060,7 +2068,7 @@
|
|
2060
2068
|
</xsl:if>
|
2061
2069
|
</xsl:template>
|
2062
2070
|
|
2063
|
-
<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">
|
2071
|
+
<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">
|
2064
2072
|
<xsl:call-template name="getLang"/>
|
2065
2073
|
</xsl:variable><xsl:variable name="pageWidth_">
|
2066
2074
|
210
|
@@ -2075,20 +2083,7 @@
|
|
2075
2083
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
2076
2084
|
20
|
2077
2085
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
2078
|
-
|
2079
|
-
<title-edition lang="en">
|
2080
|
-
|
2081
|
-
<xsl:text>Edition </xsl:text>
|
2082
|
-
|
2083
|
-
</title-edition>
|
2084
|
-
|
2085
|
-
<title-edition lang="fr">
|
2086
|
-
<xsl:text>Édition </xsl:text>
|
2087
|
-
</title-edition>
|
2088
2086
|
|
2089
|
-
<title-edition lang="ru">
|
2090
|
-
<xsl:text>Издание </xsl:text>
|
2091
|
-
</title-edition>
|
2092
2087
|
|
2093
2088
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
2094
2089
|
<title-toc lang="en">
|
@@ -2167,7 +2162,7 @@
|
|
2167
2162
|
</xsl:variable><xsl:variable name="bibdata">
|
2168
2163
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
2169
2164
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
2170
|
-
</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">
|
2165
|
+
</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">
|
2171
2166
|
<xsl:param name="name"/>
|
2172
2167
|
<xsl:param name="lang"/>
|
2173
2168
|
<xsl:variable name="lang_">
|
@@ -2210,7 +2205,30 @@
|
|
2210
2205
|
|
2211
2206
|
|
2212
2207
|
|
2213
|
-
</xsl:attribute-set><xsl:
|
2208
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
2209
|
+
<xsl:param name="root-style"/>
|
2210
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
2211
|
+
|
2212
|
+
<xsl:variable name="additional_fonts_">
|
2213
|
+
<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']">
|
2214
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
2215
|
+
</xsl:for-each>
|
2216
|
+
</xsl:variable>
|
2217
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
2218
|
+
|
2219
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
2220
|
+
<xsl:choose>
|
2221
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
2222
|
+
<xsl:attribute name="{local-name()}">
|
2223
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
2224
|
+
</xsl:attribute>
|
2225
|
+
</xsl:when>
|
2226
|
+
<xsl:otherwise>
|
2227
|
+
<xsl:copy-of select="."/>
|
2228
|
+
</xsl:otherwise>
|
2229
|
+
</xsl:choose>
|
2230
|
+
</xsl:for-each>
|
2231
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
2214
2232
|
|
2215
2233
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
2216
2234
|
|
@@ -2270,7 +2288,6 @@
|
|
2270
2288
|
|
2271
2289
|
|
2272
2290
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
2273
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
2274
2291
|
|
2275
2292
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
2276
2293
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -2353,6 +2370,7 @@
|
|
2353
2370
|
|
2354
2371
|
|
2355
2372
|
|
2373
|
+
|
2356
2374
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
2357
2375
|
|
2358
2376
|
|
@@ -2720,7 +2738,7 @@
|
|
2720
2738
|
|
2721
2739
|
|
2722
2740
|
|
2723
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2741
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
2724
2742
|
|
2725
2743
|
|
2726
2744
|
|
@@ -3423,22 +3441,32 @@
|
|
3423
3441
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3424
3442
|
<xsl:apply-templates select="."/>
|
3425
3443
|
</xsl:for-each>
|
3426
|
-
</xsl:template><xsl:variable name="
|
3427
|
-
|
3428
|
-
|
3429
|
-
|
3430
|
-
|
3431
|
-
|
3432
|
-
|
3444
|
+
</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">
|
3445
|
+
|
3446
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3447
|
+
<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))"/>
|
3448
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3449
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3450
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3451
|
+
<xsl:with-param name="text" select="$text"/>
|
3452
|
+
</xsl:call-template>
|
3453
|
+
|
3454
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
3455
|
+
<xsl:param name="tag_open"/>
|
3456
|
+
<xsl:param name="tag_close"/>
|
3433
3457
|
<xsl:param name="text"/>
|
3434
3458
|
<xsl:choose>
|
3435
3459
|
<xsl:when test="contains($text, $tag_open)">
|
3436
3460
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3437
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
3461
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
3438
3462
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3439
|
-
<
|
3440
|
-
|
3441
|
-
|
3463
|
+
<fo:inline keep-together.within-line="always">
|
3464
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3465
|
+
</fo:inline>
|
3466
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
3467
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3468
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
3469
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
3442
3470
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3443
3471
|
</xsl:call-template>
|
3444
3472
|
</xsl:when>
|
@@ -3446,6 +3474,8 @@
|
|
3446
3474
|
</xsl:choose>
|
3447
3475
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3448
3476
|
<xsl:value-of select="$linebreak"/>
|
3477
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
3478
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3449
3479
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
3450
3480
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
3451
3481
|
<xsl:apply-templates/>
|
@@ -3520,8 +3550,23 @@
|
|
3520
3550
|
</xsl:call-template>
|
3521
3551
|
|
3522
3552
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
3523
|
-
|
3524
|
-
|
3553
|
+
<xsl:choose>
|
3554
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
3555
|
+
<xsl:value-of select="."/>
|
3556
|
+
</xsl:when>
|
3557
|
+
<xsl:otherwise>
|
3558
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
3559
|
+
</xsl:otherwise>
|
3560
|
+
</xsl:choose>
|
3561
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
3562
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
3563
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
3564
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
3565
|
+
<xsl:choose>
|
3566
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
3567
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
3568
|
+
</xsl:choose>
|
3569
|
+
</xsl:for-each>
|
3525
3570
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3526
3571
|
|
3527
3572
|
<xsl:variable name="table-preamble">
|
@@ -3651,16 +3696,9 @@
|
|
3651
3696
|
</xsl:for-each>
|
3652
3697
|
</xsl:when>
|
3653
3698
|
<xsl:otherwise>
|
3654
|
-
<xsl:
|
3655
|
-
<xsl:
|
3656
|
-
|
3657
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3658
|
-
</xsl:when>
|
3659
|
-
<xsl:otherwise>
|
3660
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3661
|
-
</xsl:otherwise>
|
3662
|
-
</xsl:choose>
|
3663
|
-
</xsl:for-each>
|
3699
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3700
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3701
|
+
</xsl:call-template>
|
3664
3702
|
</xsl:otherwise>
|
3665
3703
|
</xsl:choose>
|
3666
3704
|
|
@@ -3824,6 +3862,7 @@
|
|
3824
3862
|
<xsl:with-param name="text" select="$td_text"/>
|
3825
3863
|
</xsl:call-template>
|
3826
3864
|
</xsl:variable>
|
3865
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
3827
3866
|
<xsl:call-template name="tokenize">
|
3828
3867
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
3829
3868
|
<!-- 2009 thinspace -->
|
@@ -3836,6 +3875,7 @@
|
|
3836
3875
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3837
3876
|
</xsl:call-template>
|
3838
3877
|
</xsl:variable>
|
3878
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
3839
3879
|
<width>
|
3840
3880
|
<xsl:variable name="divider">
|
3841
3881
|
<xsl:choose>
|
@@ -3868,6 +3908,10 @@
|
|
3868
3908
|
<xsl:with-param name="table" select="$table"/>
|
3869
3909
|
</xsl:call-template>
|
3870
3910
|
</xsl:if>
|
3911
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
|
3912
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
3913
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
3914
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
3871
3915
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
3872
3916
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
3873
3917
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
@@ -3975,16 +4019,9 @@
|
|
3975
4019
|
</xsl:for-each>
|
3976
4020
|
</xsl:when>
|
3977
4021
|
<xsl:otherwise>
|
3978
|
-
<xsl:
|
3979
|
-
<xsl:
|
3980
|
-
|
3981
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3982
|
-
</xsl:when>
|
3983
|
-
<xsl:otherwise>
|
3984
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3985
|
-
</xsl:otherwise>
|
3986
|
-
</xsl:choose>
|
3987
|
-
</xsl:for-each>
|
4022
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4023
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4024
|
+
</xsl:call-template>
|
3988
4025
|
</xsl:otherwise>
|
3989
4026
|
</xsl:choose>
|
3990
4027
|
|
@@ -4575,8 +4612,10 @@
|
|
4575
4612
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
4576
4613
|
</xsl:variable>
|
4577
4614
|
|
4615
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
4616
|
+
|
4578
4617
|
<xsl:choose>
|
4579
|
-
<xsl:when test="$
|
4618
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
4580
4619
|
|
4581
4620
|
<fo:block margin-bottom="12pt" text-align="left">
|
4582
4621
|
|
@@ -4591,7 +4630,7 @@
|
|
4591
4630
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
4592
4631
|
</fo:block>
|
4593
4632
|
|
4594
|
-
</xsl:when>
|
4633
|
+
</xsl:when> <!-- END: only one component -->
|
4595
4634
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4596
4635
|
<fo:block margin-bottom="12pt" text-align="left">
|
4597
4636
|
|
@@ -4607,8 +4646,8 @@
|
|
4607
4646
|
</xsl:variable>
|
4608
4647
|
<xsl:value-of select="$title-where"/>:
|
4609
4648
|
</fo:block>
|
4610
|
-
</xsl:when>
|
4611
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
4649
|
+
</xsl:when> <!-- END: a few components -->
|
4650
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
4612
4651
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
4613
4652
|
|
4614
4653
|
|
@@ -4621,11 +4660,11 @@
|
|
4621
4660
|
</xsl:variable>
|
4622
4661
|
<xsl:value-of select="$title-key"/>
|
4623
4662
|
</fo:block>
|
4624
|
-
</xsl:when>
|
4663
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
4625
4664
|
</xsl:choose>
|
4626
4665
|
|
4627
4666
|
<!-- a few components -->
|
4628
|
-
<xsl:if test="
|
4667
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
4629
4668
|
<fo:block>
|
4630
4669
|
|
4631
4670
|
|
@@ -4668,21 +4707,28 @@
|
|
4668
4707
|
<xsl:apply-templates mode="dl"/>
|
4669
4708
|
</tbody>
|
4670
4709
|
</xsl:variable>
|
4671
|
-
<!-- html-table<xsl:copy-of select="$html-table"/> -->
|
4710
|
+
<!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
|
4672
4711
|
<xsl:variable name="colwidths">
|
4673
4712
|
<xsl:call-template name="calculate-column-widths">
|
4674
4713
|
<xsl:with-param name="cols-count" select="2"/>
|
4675
4714
|
<xsl:with-param name="table" select="$html-table"/>
|
4676
4715
|
</xsl:call-template>
|
4677
4716
|
</xsl:variable>
|
4678
|
-
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4717
|
+
<!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4679
4718
|
<xsl:variable name="maxlength_dt">
|
4680
4719
|
<xsl:call-template name="getMaxLength_dt"/>
|
4681
4720
|
</xsl:variable>
|
4721
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
4722
|
+
false
|
4723
|
+
</xsl:variable>
|
4724
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
4725
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
4682
4726
|
<xsl:call-template name="setColumnWidth_dl">
|
4683
4727
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4684
4728
|
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4729
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
4685
4730
|
</xsl:call-template>
|
4731
|
+
|
4686
4732
|
<fo:table-body>
|
4687
4733
|
<xsl:apply-templates>
|
4688
4734
|
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
@@ -4691,12 +4737,13 @@
|
|
4691
4737
|
</fo:table>
|
4692
4738
|
</fo:block>
|
4693
4739
|
</fo:block>
|
4694
|
-
</xsl:if>
|
4740
|
+
</xsl:if> <!-- END: a few components -->
|
4695
4741
|
</fo:block-container>
|
4696
4742
|
</fo:block-container>
|
4697
4743
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
4698
4744
|
<xsl:param name="colwidths"/>
|
4699
4745
|
<xsl:param name="maxlength_dt"/>
|
4746
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
4700
4747
|
<xsl:choose>
|
4701
4748
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
4702
4749
|
<fo:table-column column-width="50%"/>
|
@@ -4704,6 +4751,11 @@
|
|
4704
4751
|
</xsl:when>
|
4705
4752
|
<xsl:otherwise>
|
4706
4753
|
<xsl:choose>
|
4754
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
4755
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4756
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4757
|
+
</xsl:call-template>
|
4758
|
+
</xsl:when>
|
4707
4759
|
<!-- to set width check most wide chars like `W` -->
|
4708
4760
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
4709
4761
|
<fo:table-column column-width="7%"/>
|
@@ -4734,20 +4786,25 @@
|
|
4734
4786
|
<fo:table-column column-width="60%"/>
|
4735
4787
|
</xsl:when>
|
4736
4788
|
<xsl:otherwise>
|
4737
|
-
<xsl:
|
4738
|
-
<xsl:
|
4739
|
-
|
4740
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
4741
|
-
</xsl:when>
|
4742
|
-
<xsl:otherwise>
|
4743
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4744
|
-
</xsl:otherwise>
|
4745
|
-
</xsl:choose>
|
4746
|
-
</xsl:for-each>
|
4789
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4790
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4791
|
+
</xsl:call-template>
|
4747
4792
|
</xsl:otherwise>
|
4748
4793
|
</xsl:choose>
|
4749
4794
|
</xsl:otherwise>
|
4750
4795
|
</xsl:choose>
|
4796
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
4797
|
+
<xsl:param name="colwidths"/>
|
4798
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
4799
|
+
<xsl:choose>
|
4800
|
+
<xsl:when test=". = 1 or . = 0">
|
4801
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
4802
|
+
</xsl:when>
|
4803
|
+
<xsl:otherwise>
|
4804
|
+
<fo:table-column column-width="proportional-column-width({.})"/>
|
4805
|
+
</xsl:otherwise>
|
4806
|
+
</xsl:choose>
|
4807
|
+
</xsl:for-each>
|
4751
4808
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
4752
4809
|
<xsl:variable name="lengths">
|
4753
4810
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -4771,7 +4828,6 @@
|
|
4771
4828
|
<xsl:value-of select="$maxLength"/>
|
4772
4829
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
4773
4830
|
<xsl:param name="key_iso"/>
|
4774
|
-
|
4775
4831
|
<!-- <tr>
|
4776
4832
|
<td>NOTE</td>
|
4777
4833
|
<td>
|
@@ -4779,18 +4835,30 @@
|
|
4779
4835
|
</td>
|
4780
4836
|
</tr>
|
4781
4837
|
-->
|
4782
|
-
|
4838
|
+
<!-- OLD Variant -->
|
4839
|
+
<!-- <fo:table-row>
|
4783
4840
|
<fo:table-cell>
|
4784
4841
|
<fo:block margin-top="6pt">
|
4785
4842
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4786
4843
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4787
4844
|
</xsl:if>
|
4788
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
4845
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
4789
4846
|
</fo:block>
|
4790
4847
|
</fo:table-cell>
|
4791
4848
|
<fo:table-cell>
|
4792
4849
|
<fo:block>
|
4793
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
4850
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
4851
|
+
</fo:block>
|
4852
|
+
</fo:table-cell>
|
4853
|
+
</fo:table-row> -->
|
4854
|
+
<!-- <tr>
|
4855
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
4856
|
+
</tr>
|
4857
|
+
-->
|
4858
|
+
<fo:table-row>
|
4859
|
+
<fo:table-cell number-columns-spanned="2">
|
4860
|
+
<fo:block>
|
4861
|
+
<xsl:call-template name="note"/>
|
4794
4862
|
</fo:block>
|
4795
4863
|
</fo:table-cell>
|
4796
4864
|
</fo:table-row>
|
@@ -4902,13 +4970,15 @@
|
|
4902
4970
|
<xsl:choose>
|
4903
4971
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4904
4972
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4905
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4973
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4906
4974
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4907
4975
|
</xsl:choose>
|
4908
4976
|
</xsl:attribute>
|
4909
4977
|
</xsl:if>
|
4910
4978
|
<xsl:apply-templates/>
|
4911
4979
|
</fo:inline>
|
4980
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4981
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
4912
4982
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
4913
4983
|
<fo:inline text-decoration="underline">
|
4914
4984
|
<xsl:apply-templates/>
|
@@ -5056,41 +5126,50 @@
|
|
5056
5126
|
<fo:block break-after="page"/>
|
5057
5127
|
<fo:block> </fo:block>
|
5058
5128
|
<fo:block break-after="page"/>
|
5129
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
5130
|
+
<xsl:apply-templates/>
|
5059
5131
|
</xsl:template><xsl:template name="tokenize">
|
5060
5132
|
<xsl:param name="text"/>
|
5061
5133
|
<xsl:param name="separator" select="' '"/>
|
5062
5134
|
<xsl:choose>
|
5063
5135
|
<xsl:when test="not(contains($text, $separator))">
|
5064
5136
|
<word>
|
5065
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5066
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5067
5137
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
5068
|
-
<xsl:variable name="len_str">
|
5069
|
-
<xsl:choose>
|
5070
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5071
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5072
|
-
</xsl:when>
|
5073
|
-
<xsl:otherwise>
|
5074
|
-
<xsl:value-of select="$len_str_tmp"/>
|
5075
|
-
</xsl:otherwise>
|
5076
|
-
</xsl:choose>
|
5077
|
-
</xsl:variable>
|
5078
|
-
|
5079
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5080
|
-
<xsl:message>
|
5081
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5082
|
-
len_str=<xsl:value-of select="$len_str"/>
|
5083
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5084
|
-
</xsl:message>
|
5085
|
-
</xsl:if> -->
|
5086
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5087
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5088
5138
|
<xsl:choose>
|
5089
|
-
<xsl:when test="$
|
5090
|
-
<xsl:value-of select="$
|
5139
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
5140
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5091
5141
|
</xsl:when>
|
5092
5142
|
<xsl:otherwise>
|
5093
|
-
<xsl:
|
5143
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5144
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5145
|
+
<xsl:variable name="len_str">
|
5146
|
+
<xsl:choose>
|
5147
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5148
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5149
|
+
</xsl:when>
|
5150
|
+
<xsl:otherwise>
|
5151
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5152
|
+
</xsl:otherwise>
|
5153
|
+
</xsl:choose>
|
5154
|
+
</xsl:variable>
|
5155
|
+
|
5156
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5157
|
+
<xsl:message>
|
5158
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5159
|
+
len_str=<xsl:value-of select="$len_str"/>
|
5160
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5161
|
+
</xsl:message>
|
5162
|
+
</xsl:if> -->
|
5163
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5164
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5165
|
+
<xsl:choose>
|
5166
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
5167
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
5168
|
+
</xsl:when>
|
5169
|
+
<xsl:otherwise>
|
5170
|
+
<xsl:value-of select="$len_str"/>
|
5171
|
+
</xsl:otherwise>
|
5172
|
+
</xsl:choose>
|
5094
5173
|
</xsl:otherwise>
|
5095
5174
|
</xsl:choose>
|
5096
5175
|
</word>
|
@@ -5176,24 +5255,28 @@
|
|
5176
5255
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
5177
5256
|
<xsl:param name="text" select="."/>
|
5178
5257
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
5258
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
5179
5259
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
5260
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
5180
5261
|
<xsl:variable name="zero-space"></xsl:variable>
|
5181
5262
|
<xsl:choose>
|
5182
5263
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
5183
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
5264
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
5184
5265
|
<xsl:value-of select="$zero-space-after-equals"/>
|
5185
5266
|
<xsl:value-of select="$zero-space"/>
|
5186
5267
|
<xsl:call-template name="add-zero-spaces-equal">
|
5187
5268
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
5188
|
-
</xsl:call-template>
|
5269
|
+
</xsl:call-template> -->
|
5270
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
5189
5271
|
</xsl:when>
|
5190
5272
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
5191
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
5273
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
5192
5274
|
<xsl:value-of select="$zero-space-after-equal"/>
|
5193
5275
|
<xsl:value-of select="$zero-space"/>
|
5194
5276
|
<xsl:call-template name="add-zero-spaces-equal">
|
5195
5277
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
5196
|
-
</xsl:call-template>
|
5278
|
+
</xsl:call-template> -->
|
5279
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
5197
5280
|
</xsl:when>
|
5198
5281
|
<xsl:otherwise>
|
5199
5282
|
<xsl:value-of select="$text"/>
|
@@ -5361,6 +5444,9 @@
|
|
5361
5444
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
5362
5445
|
|
5363
5446
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
5447
|
+
|
5448
|
+
|
5449
|
+
|
5364
5450
|
|
5365
5451
|
|
5366
5452
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -5368,48 +5454,80 @@
|
|
5368
5454
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5369
5455
|
</xsl:call-template>
|
5370
5456
|
|
5457
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
5458
|
+
<!-- insert helper tag -->
|
5459
|
+
<!-- set unique font-size (fiction) -->
|
5460
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
5461
|
+
<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 -->
|
5462
|
+
</xsl:if>
|
5371
5463
|
|
5372
|
-
|
5373
|
-
|
5374
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
5464
|
+
<xsl:variable name="mathml_content">
|
5465
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5375
5466
|
</xsl:variable>
|
5376
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
5377
5467
|
|
5468
|
+
|
5469
|
+
<xsl:call-template name="mathml_instream_object">
|
5470
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
5471
|
+
</xsl:call-template>
|
5378
5472
|
|
5379
|
-
|
5380
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5381
|
-
<xsl:variable name="comment_text_">
|
5382
|
-
<xsl:choose>
|
5383
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5384
|
-
<xsl:value-of select="$comment_text_following"/>
|
5385
|
-
</xsl:when>
|
5386
|
-
<xsl:otherwise>
|
5387
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5388
|
-
</xsl:otherwise>
|
5389
|
-
</xsl:choose>
|
5390
|
-
</xsl:variable>
|
5391
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5392
|
-
|
5393
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
5394
|
-
<!-- put Mathin Alternate Text -->
|
5395
|
-
<xsl:attribute name="fox:alt-text">
|
5396
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
5397
|
-
</xsl:attribute>
|
5398
|
-
</xsl:if>
|
5399
|
-
|
5400
|
-
<xsl:variable name="mathml_content">
|
5401
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5402
|
-
</xsl:variable>
|
5403
|
-
<!-- put MathML in Actual Text -->
|
5404
|
-
<xsl:attribute name="fox:actual-text">
|
5405
|
-
<xsl:value-of select="$mathml_content"/>
|
5406
|
-
</xsl:attribute>
|
5407
|
-
|
5408
|
-
|
5409
|
-
|
5410
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5411
|
-
</fo:instream-foreign-object>
|
5473
|
+
|
5412
5474
|
</fo:inline>
|
5475
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
5476
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5477
|
+
<xsl:variable name="comment_text_">
|
5478
|
+
<xsl:choose>
|
5479
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5480
|
+
<xsl:value-of select="$comment_text_following"/>
|
5481
|
+
</xsl:when>
|
5482
|
+
<xsl:otherwise>
|
5483
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5484
|
+
</xsl:otherwise>
|
5485
|
+
</xsl:choose>
|
5486
|
+
</xsl:variable>
|
5487
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5488
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
5489
|
+
<xsl:value-of select="$comment_text"/>
|
5490
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
5491
|
+
<xsl:param name="comment_text"/>
|
5492
|
+
<xsl:param name="mathml_content"/>
|
5493
|
+
|
5494
|
+
<xsl:variable name="comment_text_">
|
5495
|
+
<xsl:choose>
|
5496
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
5497
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
5498
|
+
</xsl:choose>
|
5499
|
+
</xsl:variable>
|
5500
|
+
|
5501
|
+
<xsl:variable name="mathml">
|
5502
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
5503
|
+
</xsl:variable>
|
5504
|
+
|
5505
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
5506
|
+
|
5507
|
+
|
5508
|
+
|
5509
|
+
|
5510
|
+
|
5511
|
+
|
5512
|
+
|
5513
|
+
<!-- put MathML in Actual Text -->
|
5514
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
5515
|
+
<xsl:attribute name="fox:actual-text">
|
5516
|
+
<xsl:value-of select="$mathml_content"/>
|
5517
|
+
</xsl:attribute>
|
5518
|
+
|
5519
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
5520
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
5521
|
+
<!-- put Mathin Alternate Text -->
|
5522
|
+
<xsl:attribute name="fox:alt-text">
|
5523
|
+
<xsl:value-of select="$comment_text_"/>
|
5524
|
+
</xsl:attribute>
|
5525
|
+
</xsl:if>
|
5526
|
+
<!-- </xsl:if> -->
|
5527
|
+
|
5528
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5529
|
+
|
5530
|
+
</fo:instream-foreign-object>
|
5413
5531
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
5414
5532
|
<!-- <xsl:text>a+b</xsl:text> -->
|
5415
5533
|
<xsl:text><</xsl:text>
|
@@ -5440,7 +5558,9 @@
|
|
5440
5558
|
<!-- replace start and end spaces to non-break space -->
|
5441
5559
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
5442
5560
|
</xsl:copy>
|
5443
|
-
</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="
|
5561
|
+
</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">
|
5562
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
5563
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
5444
5564
|
<xsl:variable name="target">
|
5445
5565
|
<xsl:choose>
|
5446
5566
|
<xsl:when test="@updatetype = 'true'">
|
@@ -5673,7 +5793,12 @@
|
|
5673
5793
|
|
5674
5794
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
5675
5795
|
|
5796
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
5797
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
5798
|
+
</xsl:if>
|
5799
|
+
|
5676
5800
|
|
5801
|
+
|
5677
5802
|
|
5678
5803
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
5679
5804
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -6034,18 +6159,33 @@
|
|
6034
6159
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
6035
6160
|
<xsl:copy>
|
6036
6161
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
6037
|
-
<xsl:variable name="
|
6162
|
+
<xsl:variable name="viewbox_">
|
6038
6163
|
<xsl:call-template name="split">
|
6039
6164
|
<xsl:with-param name="pText" select="@viewBox"/>
|
6040
6165
|
<xsl:with-param name="sep" select="' '"/>
|
6041
6166
|
</xsl:call-template>
|
6042
6167
|
</xsl:variable>
|
6168
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
6169
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
6170
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
6171
|
+
|
6043
6172
|
<xsl:attribute name="width">
|
6044
|
-
<xsl:
|
6173
|
+
<xsl:choose>
|
6174
|
+
<xsl:when test="$width != ''">
|
6175
|
+
<xsl:value-of select="round($width)"/>
|
6176
|
+
</xsl:when>
|
6177
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
6178
|
+
</xsl:choose>
|
6045
6179
|
</xsl:attribute>
|
6046
6180
|
<xsl:attribute name="height">
|
6047
|
-
<xsl:
|
6181
|
+
<xsl:choose>
|
6182
|
+
<xsl:when test="$height != ''">
|
6183
|
+
<xsl:value-of select="round($height)"/>
|
6184
|
+
</xsl:when>
|
6185
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
6186
|
+
</xsl:choose>
|
6048
6187
|
</xsl:attribute>
|
6188
|
+
|
6049
6189
|
<xsl:apply-templates mode="svg_update"/>
|
6050
6190
|
</xsl:copy>
|
6051
6191
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -6240,7 +6380,11 @@
|
|
6240
6380
|
<xsl:apply-templates mode="bookmarks"/>
|
6241
6381
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
6242
6382
|
<xsl:apply-templates select="."/>
|
6243
|
-
</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() = '
|
6383
|
+
</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">
|
6384
|
+
<xsl:apply-templates mode="contents"/>
|
6385
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
6386
|
+
<xsl:apply-templates mode="bookmarks"/>
|
6387
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
6244
6388
|
<xsl:apply-templates mode="bookmarks"/>
|
6245
6389
|
</xsl:template><xsl:template name="addBookmarks">
|
6246
6390
|
<xsl:param name="contents"/>
|
@@ -6522,7 +6666,9 @@
|
|
6522
6666
|
<xsl:apply-templates/>
|
6523
6667
|
</xsl:otherwise>
|
6524
6668
|
</xsl:choose>
|
6525
|
-
</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() = '
|
6669
|
+
</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">
|
6670
|
+
<xsl:value-of select="."/>
|
6671
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
6526
6672
|
<xsl:text> </xsl:text>
|
6527
6673
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
6528
6674
|
<xsl:copy>
|
@@ -6553,9 +6699,22 @@
|
|
6553
6699
|
</xsl:when>
|
6554
6700
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
6555
6701
|
</xsl:choose>
|
6702
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6703
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6704
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6705
|
+
<xsl:apply-templates mode="contents_item"/>
|
6556
6706
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
6557
6707
|
|
6558
6708
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6709
|
+
|
6710
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6711
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6712
|
+
</xsl:if>
|
6713
|
+
|
6714
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6715
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6716
|
+
</xsl:if>
|
6717
|
+
|
6559
6718
|
<xsl:copy-of select="@id"/>
|
6560
6719
|
|
6561
6720
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -6655,17 +6814,15 @@
|
|
6655
6814
|
|
6656
6815
|
<!-- split text by zero-width space -->
|
6657
6816
|
<xsl:variable name="text_step4">
|
6658
|
-
<xsl:call-template name="
|
6817
|
+
<xsl:call-template name="split_for_interspers">
|
6659
6818
|
<xsl:with-param name="pText" select="$text_step3"/>
|
6660
6819
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
6661
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
6662
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
6663
6820
|
</xsl:call-template>
|
6664
6821
|
</xsl:variable>
|
6665
6822
|
|
6666
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
6823
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
6667
6824
|
<xsl:choose>
|
6668
|
-
<xsl:when test="
|
6825
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
6669
6826
|
<xsl:call-template name="interspers">
|
6670
6827
|
<xsl:with-param name="str" select="."/>
|
6671
6828
|
</xsl:call-template>
|
@@ -6676,6 +6833,30 @@
|
|
6676
6833
|
</xsl:choose>
|
6677
6834
|
</xsl:for-each>
|
6678
6835
|
|
6836
|
+
</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">
|
6837
|
+
<xsl:param name="pText" select="."/>
|
6838
|
+
<xsl:param name="sep" select="','"/>
|
6839
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
6840
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
6841
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
6842
|
+
<xsl:call-template name="replace_tag_interspers">
|
6843
|
+
<xsl:with-param name="text" select="$text"/>
|
6844
|
+
</xsl:call-template>
|
6845
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
6846
|
+
<xsl:param name="text"/>
|
6847
|
+
<xsl:choose>
|
6848
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
6849
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
6850
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
6851
|
+
<interspers>
|
6852
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
6853
|
+
</interspers>
|
6854
|
+
<xsl:call-template name="replace_tag_interspers">
|
6855
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
6856
|
+
</xsl:call-template>
|
6857
|
+
</xsl:when>
|
6858
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
6859
|
+
</xsl:choose>
|
6679
6860
|
</xsl:template><xsl:template name="interspers">
|
6680
6861
|
<xsl:param name="str"/>
|
6681
6862
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -7011,39 +7192,67 @@
|
|
7011
7192
|
</xsl:otherwise>
|
7012
7193
|
</xsl:choose>
|
7013
7194
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
7014
|
-
|
7015
|
-
|
7195
|
+
|
7196
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
7197
|
+
|
7016
7198
|
|
7199
|
+
|
7017
7200
|
<xsl:variable name="fo_element">
|
7018
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
7201
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
7019
7202
|
block
|
7020
7203
|
</xsl:variable>
|
7021
7204
|
|
7022
|
-
|
7023
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
7024
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7025
|
-
</xsl:apply-templates>
|
7205
|
+
<fo:block-container margin-left="0mm">
|
7026
7206
|
|
7027
|
-
|
7028
|
-
|
7029
|
-
<
|
7030
|
-
|
7031
|
-
|
7207
|
+
<xsl:choose>
|
7208
|
+
|
7209
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
7210
|
+
|
7211
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
7212
|
+
<fo:block>
|
7213
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
7032
7214
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7033
7215
|
</xsl:apply-templates>
|
7216
|
+
</fo:block>
|
7217
|
+
|
7218
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7219
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7220
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
7221
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7222
|
+
</xsl:apply-templates>
|
7223
|
+
</fo:block-container>
|
7034
7224
|
</fo:block-container>
|
7035
|
-
</
|
7036
|
-
|
7037
|
-
|
7038
|
-
|
7039
|
-
|
7040
|
-
|
7041
|
-
|
7042
|
-
|
7043
|
-
|
7044
|
-
|
7045
|
-
|
7046
|
-
|
7225
|
+
</xsl:when> <!-- end block -->
|
7226
|
+
|
7227
|
+
<xsl:otherwise> <!-- inline -->
|
7228
|
+
|
7229
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
7230
|
+
<fo:block>
|
7231
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
7232
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7233
|
+
</xsl:apply-templates>
|
7234
|
+
<fo:inline>
|
7235
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
7236
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7237
|
+
</xsl:apply-templates>
|
7238
|
+
</fo:inline>
|
7239
|
+
</fo:block>
|
7240
|
+
|
7241
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
7242
|
+
<!-- display further elements in blocks -->
|
7243
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
7244
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7245
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
7246
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
7247
|
+
</xsl:apply-templates>
|
7248
|
+
</fo:block-container>
|
7249
|
+
</fo:block-container>
|
7250
|
+
</xsl:if>
|
7251
|
+
</xsl:otherwise> <!-- end inline -->
|
7252
|
+
|
7253
|
+
</xsl:choose>
|
7254
|
+
</fo:block-container>
|
7255
|
+
</fo:block-container>
|
7047
7256
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
7048
7257
|
<xsl:param name="fo_element">block</xsl:param>
|
7049
7258
|
|
@@ -7075,10 +7284,16 @@
|
|
7075
7284
|
</xsl:variable>
|
7076
7285
|
<xsl:choose>
|
7077
7286
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
7078
|
-
<fo:block
|
7079
|
-
|
7080
|
-
|
7081
|
-
|
7287
|
+
<fo:block-container>
|
7288
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
7289
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7290
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7291
|
+
</xsl:if>
|
7292
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
7293
|
+
|
7294
|
+
<xsl:apply-templates/>
|
7295
|
+
</fo:block>
|
7296
|
+
</fo:block-container>
|
7082
7297
|
</xsl:when>
|
7083
7298
|
<xsl:otherwise>
|
7084
7299
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -7123,7 +7338,7 @@
|
|
7123
7338
|
</xsl:otherwise>
|
7124
7339
|
</xsl:choose> -->
|
7125
7340
|
</fo:block>
|
7126
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
7341
|
+
</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">
|
7127
7342
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
7128
7343
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
7129
7344
|
<xsl:if test="normalize-space() != ''">
|
@@ -7257,7 +7472,16 @@
|
|
7257
7472
|
</fo:inline>
|
7258
7473
|
</xsl:when>
|
7259
7474
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
7260
|
-
|
7475
|
+
|
7476
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
7477
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
7478
|
+
<xsl:choose>
|
7479
|
+
<xsl:when test="$uri_src != ''">
|
7480
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
7481
|
+
</xsl:when>
|
7482
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
7483
|
+
</xsl:choose>
|
7484
|
+
|
7261
7485
|
</xsl:otherwise>
|
7262
7486
|
</xsl:choose>
|
7263
7487
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -7442,10 +7666,24 @@
|
|
7442
7666
|
|
7443
7667
|
</fo:block>
|
7444
7668
|
<xsl:apply-templates/>
|
7445
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7669
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
7446
7670
|
<!-- comment 2019-11-29 -->
|
7447
7671
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
7448
7672
|
<xsl:apply-templates /> -->
|
7673
|
+
|
7674
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7675
|
+
|
7676
|
+
<xsl:choose>
|
7677
|
+
<!-- if there isn't the attribute '@from', then -->
|
7678
|
+
<xsl:when test="$id_from = ''">
|
7679
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7680
|
+
</xsl:when>
|
7681
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7682
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7683
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7684
|
+
</xsl:when>
|
7685
|
+
</xsl:choose>
|
7686
|
+
|
7449
7687
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
7450
7688
|
<!-- 0xA0 to space replacement -->
|
7451
7689
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -7804,7 +8042,10 @@
|
|
7804
8042
|
<!-- to split by '_' and other chars -->
|
7805
8043
|
<xsl:call-template name="add-zero-spaces-java"/>
|
7806
8044
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
7807
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
8045
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
8046
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
8047
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
8048
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
|
7808
8049
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
7809
8050
|
<!-- <row>
|
7810
8051
|
<date>05-07-2013</date>
|
@@ -8373,6 +8614,120 @@
|
|
8373
8614
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8374
8615
|
</xsl:for-each>
|
8375
8616
|
</xsl:copy>
|
8617
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
8618
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
8619
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
8620
|
+
<xsl:copy>
|
8621
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
8622
|
+
</xsl:copy>
|
8623
|
+
</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">
|
8624
|
+
|
8625
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
8626
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
8627
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8628
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8629
|
+
<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))"/>
|
8630
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
8631
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8632
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8633
|
+
<xsl:with-param name="text" select="$text_"/>
|
8634
|
+
</xsl:call-template></text></xsl:variable>
|
8635
|
+
|
8636
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
8637
|
+
|
8638
|
+
<xsl:variable name="text2">
|
8639
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
8640
|
+
<xsl:copy-of select="."/>
|
8641
|
+
</xsl:for-each></text>
|
8642
|
+
</xsl:variable>
|
8643
|
+
|
8644
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
8645
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
8646
|
+
<xsl:variable name="text3">
|
8647
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
8648
|
+
<xsl:choose>
|
8649
|
+
<xsl:when test="self::text()">
|
8650
|
+
<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))"/>
|
8651
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8652
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8653
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8654
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8655
|
+
</xsl:call-template></text></xsl:variable>
|
8656
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8657
|
+
</xsl:when>
|
8658
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8659
|
+
</xsl:choose>
|
8660
|
+
</xsl:for-each></text>
|
8661
|
+
</xsl:variable>
|
8662
|
+
|
8663
|
+
<xsl:choose>
|
8664
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8665
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8666
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8667
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8668
|
+
<xsl:choose>
|
8669
|
+
<xsl:when test="self::text()">
|
8670
|
+
<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))"/>
|
8671
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8672
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8673
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8674
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8675
|
+
</xsl:call-template></text></xsl:variable>
|
8676
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8677
|
+
</xsl:when>
|
8678
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8679
|
+
</xsl:choose>
|
8680
|
+
</xsl:for-each>
|
8681
|
+
</xsl:when>
|
8682
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8683
|
+
</xsl:choose>
|
8684
|
+
|
8685
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8686
|
+
<xsl:param name="tag_open"/>
|
8687
|
+
<xsl:param name="tag_close"/>
|
8688
|
+
<xsl:param name="text"/>
|
8689
|
+
<xsl:choose>
|
8690
|
+
<xsl:when test="contains($text, $tag_open)">
|
8691
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8692
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8693
|
+
|
8694
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8695
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8696
|
+
</xsl:element>
|
8697
|
+
|
8698
|
+
<xsl:call-template name="replace_text_tags">
|
8699
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8700
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8701
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8702
|
+
</xsl:call-template>
|
8703
|
+
</xsl:when>
|
8704
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8705
|
+
</xsl:choose>
|
8706
|
+
</xsl:template><xsl:template name="printEdition">
|
8707
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8708
|
+
<xsl:text> </xsl:text>
|
8709
|
+
<xsl:choose>
|
8710
|
+
<xsl:when test="$edition_i18n != ''">
|
8711
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8712
|
+
<xsl:call-template name="capitalize">
|
8713
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8714
|
+
</xsl:call-template>
|
8715
|
+
</xsl:when>
|
8716
|
+
<xsl:otherwise>
|
8717
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8718
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8719
|
+
<xsl:call-template name="capitalize">
|
8720
|
+
<xsl:with-param name="str">
|
8721
|
+
<xsl:call-template name="getLocalizedString">
|
8722
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8723
|
+
</xsl:call-template>
|
8724
|
+
</xsl:with-param>
|
8725
|
+
</xsl:call-template>
|
8726
|
+
<xsl:text> </xsl:text>
|
8727
|
+
<xsl:value-of select="$edition"/>
|
8728
|
+
</xsl:if>
|
8729
|
+
</xsl:otherwise>
|
8730
|
+
</xsl:choose>
|
8376
8731
|
</xsl:template><xsl:template name="convertDate">
|
8377
8732
|
<xsl:param name="date"/>
|
8378
8733
|
<xsl:param name="format" select="'short'"/>
|