metanorma-itu 2.0.8.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2083,20 +2083,7 @@
2083
2083
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
2084
2084
  20
2085
2085
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
2086
-
2087
- <title-edition lang="en">
2088
-
2089
- <xsl:text>Edition </xsl:text>
2090
-
2091
- </title-edition>
2092
2086
 
2093
- <title-edition lang="fr">
2094
- <xsl:text>Édition </xsl:text>
2095
- </title-edition>
2096
-
2097
- <title-edition lang="ru">
2098
- <xsl:text>Издание </xsl:text>
2099
- </title-edition>
2100
2087
 
2101
2088
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
2102
2089
  <title-toc lang="en">
@@ -2175,7 +2162,7 @@
2175
2162
  </xsl:variable><xsl:variable name="bibdata">
2176
2163
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2177
2164
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2178
- </xsl:variable><xsl:variable name="linebreak">&#8232;</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">&#8232;</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">
2179
2166
  <xsl:param name="name"/>
2180
2167
  <xsl:param name="lang"/>
2181
2168
  <xsl:variable name="lang_">
@@ -2223,7 +2210,7 @@
2223
2210
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2224
2211
 
2225
2212
  <xsl:variable name="additional_fonts_">
2226
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
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']">
2227
2214
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2228
2215
  </xsl:for-each>
2229
2216
  </xsl:variable>
@@ -2301,7 +2288,6 @@
2301
2288
 
2302
2289
 
2303
2290
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
2304
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2305
2291
 
2306
2292
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2307
2293
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -2384,6 +2370,7 @@
2384
2370
 
2385
2371
 
2386
2372
 
2373
+
2387
2374
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2388
2375
 
2389
2376
 
@@ -3454,22 +3441,32 @@
3454
3441
  <xsl:sort select="@displayorder" data-type="number"/>
3455
3442
  <xsl:apply-templates select="."/>
3456
3443
  </xsl:for-each>
3457
- </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
3458
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3459
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
3460
- <xsl:call-template name="replace_fo_inline">
3461
- <xsl:with-param name="text" select="$text"/>
3462
- </xsl:call-template>
3463
- </xsl:template><xsl:template name="replace_fo_inline">
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"/>
3464
3457
  <xsl:param name="text"/>
3465
3458
  <xsl:choose>
3466
3459
  <xsl:when test="contains($text, $tag_open)">
3467
3460
  <xsl:value-of select="substring-before($text, $tag_open)"/>
3468
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
3461
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
3469
3462
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
3470
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
3471
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
3472
- <xsl:call-template name="replace_fo_inline">
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">&lt;/fo:inline&gt;</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"/>
3473
3470
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
3474
3471
  </xsl:call-template>
3475
3472
  </xsl:when>
@@ -3477,6 +3474,8 @@
3477
3474
  </xsl:choose>
3478
3475
  </xsl:template><xsl:template match="*[local-name()='br']">
3479
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>
3480
3479
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
3481
3480
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
3482
3481
  <xsl:apply-templates/>
@@ -3550,11 +3549,24 @@
3550
3549
  <xsl:with-param name="margin" select="$margin"/>
3551
3550
  </xsl:call-template>
3552
3551
 
3553
- </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:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3554
-
3555
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3556
- <xsl:call-template name="add-zero-spaces-java"/>
3557
-
3552
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
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>
3558
3570
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3559
3571
 
3560
3572
  <xsl:variable name="table-preamble">
@@ -3850,6 +3862,7 @@
3850
3862
  <xsl:with-param name="text" select="$td_text"/>
3851
3863
  </xsl:call-template>
3852
3864
  </xsl:variable>
3865
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
3853
3866
  <xsl:call-template name="tokenize">
3854
3867
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3855
3868
  <!-- 2009 thinspace -->
@@ -3862,6 +3875,7 @@
3862
3875
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
3863
3876
  </xsl:call-template>
3864
3877
  </xsl:variable>
3878
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
3865
3879
  <width>
3866
3880
  <xsl:variable name="divider">
3867
3881
  <xsl:choose>
@@ -3894,12 +3908,10 @@
3894
3908
  <xsl:with-param name="table" select="$table"/>
3895
3909
  </xsl:call-template>
3896
3910
  </xsl:if>
3897
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3898
- <xsl:apply-templates mode="td_text"/>
3899
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3900
-
3901
- <xsl:value-of select="."/>
3902
-
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')"/>
3903
3915
  </xsl:template><xsl:template match="text()" mode="td_text">
3904
3916
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3905
3917
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -4600,8 +4612,10 @@
4600
4612
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
4601
4613
  </xsl:variable>
4602
4614
 
4615
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
4616
+
4603
4617
  <xsl:choose>
4604
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
4618
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
4605
4619
 
4606
4620
  <fo:block margin-bottom="12pt" text-align="left">
4607
4621
 
@@ -4616,7 +4630,7 @@
4616
4630
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4617
4631
  </fo:block>
4618
4632
 
4619
- </xsl:when>
4633
+ </xsl:when> <!-- END: only one component -->
4620
4634
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4621
4635
  <fo:block margin-bottom="12pt" text-align="left">
4622
4636
 
@@ -4632,8 +4646,8 @@
4632
4646
  </xsl:variable>
4633
4647
  <xsl:value-of select="$title-where"/>:
4634
4648
  </fo:block>
4635
- </xsl:when>
4636
- <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 -->
4637
4651
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4638
4652
 
4639
4653
 
@@ -4646,11 +4660,11 @@
4646
4660
  </xsl:variable>
4647
4661
  <xsl:value-of select="$title-key"/>
4648
4662
  </fo:block>
4649
- </xsl:when>
4663
+ </xsl:when> <!-- END: definition list in a figure -->
4650
4664
  </xsl:choose>
4651
4665
 
4652
4666
  <!-- a few components -->
4653
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
4667
+ <xsl:if test="$onlyOneComponent = 'false'">
4654
4668
  <fo:block>
4655
4669
 
4656
4670
 
@@ -4693,27 +4707,28 @@
4693
4707
  <xsl:apply-templates mode="dl"/>
4694
4708
  </tbody>
4695
4709
  </xsl:variable>
4696
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
4710
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4697
4711
  <xsl:variable name="colwidths">
4698
4712
  <xsl:call-template name="calculate-column-widths">
4699
4713
  <xsl:with-param name="cols-count" select="2"/>
4700
4714
  <xsl:with-param name="table" select="$html-table"/>
4701
4715
  </xsl:call-template>
4702
4716
  </xsl:variable>
4703
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4717
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4704
4718
  <xsl:variable name="maxlength_dt">
4705
4719
  <xsl:call-template name="getMaxLength_dt"/>
4706
4720
  </xsl:variable>
4707
- <xsl:variable name="isContainsExpressReference_">
4721
+ <xsl:variable name="isContainsKeepTogetherTag_">
4708
4722
  false
4709
4723
  </xsl:variable>
4710
- <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4724
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4711
4725
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4712
4726
  <xsl:call-template name="setColumnWidth_dl">
4713
4727
  <xsl:with-param name="colwidths" select="$colwidths"/>
4714
4728
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4715
- <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4729
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4716
4730
  </xsl:call-template>
4731
+
4717
4732
  <fo:table-body>
4718
4733
  <xsl:apply-templates>
4719
4734
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4722,13 +4737,13 @@
4722
4737
  </fo:table>
4723
4738
  </fo:block>
4724
4739
  </fo:block>
4725
- </xsl:if>
4740
+ </xsl:if> <!-- END: a few components -->
4726
4741
  </fo:block-container>
4727
4742
  </fo:block-container>
4728
4743
  </xsl:template><xsl:template name="setColumnWidth_dl">
4729
4744
  <xsl:param name="colwidths"/>
4730
4745
  <xsl:param name="maxlength_dt"/>
4731
- <xsl:param name="isContainsExpressReference"/>
4746
+ <xsl:param name="isContainsKeepTogetherTag"/>
4732
4747
  <xsl:choose>
4733
4748
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4734
4749
  <fo:table-column column-width="50%"/>
@@ -4736,7 +4751,7 @@
4736
4751
  </xsl:when>
4737
4752
  <xsl:otherwise>
4738
4753
  <xsl:choose>
4739
- <xsl:when test="$isContainsExpressReference">
4754
+ <xsl:when test="$isContainsKeepTogetherTag">
4740
4755
  <xsl:call-template name="insertTableColumnWidth">
4741
4756
  <xsl:with-param name="colwidths" select="$colwidths"/>
4742
4757
  </xsl:call-template>
@@ -4813,7 +4828,6 @@
4813
4828
  <xsl:value-of select="$maxLength"/>
4814
4829
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
4815
4830
  <xsl:param name="key_iso"/>
4816
-
4817
4831
  <!-- <tr>
4818
4832
  <td>NOTE</td>
4819
4833
  <td>
@@ -4821,18 +4835,30 @@
4821
4835
  </td>
4822
4836
  </tr>
4823
4837
  -->
4824
- <fo:table-row>
4838
+ <!-- OLD Variant -->
4839
+ <!-- <fo:table-row>
4825
4840
  <fo:table-cell>
4826
4841
  <fo:block margin-top="6pt">
4827
4842
  <xsl:if test="normalize-space($key_iso) = 'true'">
4828
4843
  <xsl:attribute name="margin-top">0</xsl:attribute>
4829
4844
  </xsl:if>
4830
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4845
+ <xsl:apply-templates select="*[local-name() = 'name']" />
4831
4846
  </fo:block>
4832
4847
  </fo:table-cell>
4833
4848
  <fo:table-cell>
4834
4849
  <fo:block>
4835
- <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"/>
4836
4862
  </fo:block>
4837
4863
  </fo:table-cell>
4838
4864
  </fo:table-row>
@@ -4944,13 +4970,15 @@
4944
4970
  <xsl:choose>
4945
4971
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4946
4972
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4947
- <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>
4948
4974
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4949
4975
  </xsl:choose>
4950
4976
  </xsl:attribute>
4951
4977
  </xsl:if>
4952
4978
  <xsl:apply-templates/>
4953
4979
  </fo:inline>
4980
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4981
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4954
4982
  </xsl:template><xsl:template match="*[local-name()='underline']">
4955
4983
  <fo:inline text-decoration="underline">
4956
4984
  <xsl:apply-templates/>
@@ -5098,41 +5126,50 @@
5098
5126
  <fo:block break-after="page"/>
5099
5127
  <fo:block> </fo:block>
5100
5128
  <fo:block break-after="page"/>
5129
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
5130
+ <xsl:apply-templates/>
5101
5131
  </xsl:template><xsl:template name="tokenize">
5102
5132
  <xsl:param name="text"/>
5103
5133
  <xsl:param name="separator" select="' '"/>
5104
5134
  <xsl:choose>
5105
5135
  <xsl:when test="not(contains($text, $separator))">
5106
5136
  <word>
5107
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
5108
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
5109
5137
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
5110
- <xsl:variable name="len_str">
5111
- <xsl:choose>
5112
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
5113
- <xsl:value-of select="$len_str_tmp * 1.5"/>
5114
- </xsl:when>
5115
- <xsl:otherwise>
5116
- <xsl:value-of select="$len_str_tmp"/>
5117
- </xsl:otherwise>
5118
- </xsl:choose>
5119
- </xsl:variable>
5120
-
5121
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
5122
- <xsl:message>
5123
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
5124
- len_str=<xsl:value-of select="$len_str"/>
5125
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
5126
- </xsl:message>
5127
- </xsl:if> -->
5128
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
5129
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
5130
5138
  <xsl:choose>
5131
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
5132
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
5139
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
5140
+ <xsl:value-of select="$len_str_tmp"/>
5133
5141
  </xsl:when>
5134
5142
  <xsl:otherwise>
5135
- <xsl:value-of select="$len_str"/>
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 &gt; 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 &gt; 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>
5136
5173
  </xsl:otherwise>
5137
5174
  </xsl:choose>
5138
5175
  </word>
@@ -5521,7 +5558,9 @@
5521
5558
  <!-- replace start and end spaces to non-break space -->
5522
5559
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
5523
5560
  </xsl:copy>
5524
- </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="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
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">
5525
5564
  <xsl:variable name="target">
5526
5565
  <xsl:choose>
5527
5566
  <xsl:when test="@updatetype = 'true'">
@@ -6341,7 +6380,11 @@
6341
6380
  <xsl:apply-templates mode="bookmarks"/>
6342
6381
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
6343
6382
  <xsl:apply-templates select="."/>
6344
- </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() = 'stem']" mode="bookmarks">
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">
6345
6388
  <xsl:apply-templates mode="bookmarks"/>
6346
6389
  </xsl:template><xsl:template name="addBookmarks">
6347
6390
  <xsl:param name="contents"/>
@@ -6623,7 +6666,9 @@
6623
6666
  <xsl:apply-templates/>
6624
6667
  </xsl:otherwise>
6625
6668
  </xsl:choose>
6626
- </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() = 'tab']" mode="contents_item">
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">
6627
6672
  <xsl:text> </xsl:text>
6628
6673
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6629
6674
  <xsl:copy>
@@ -6654,9 +6699,22 @@
6654
6699
  </xsl:when>
6655
6700
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
6656
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"/>
6657
6706
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6658
6707
 
6659
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
+
6660
6718
  <xsl:copy-of select="@id"/>
6661
6719
 
6662
6720
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -7134,39 +7192,67 @@
7134
7192
  </xsl:otherwise>
7135
7193
  </xsl:choose>
7136
7194
  </xsl:template><xsl:template match="*[local-name() = 'example']">
7137
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
7138
-
7195
+
7196
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
7197
+
7139
7198
 
7199
+
7140
7200
  <xsl:variable name="fo_element">
7141
- <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>
7142
7202
  block
7143
7203
  </xsl:variable>
7144
7204
 
7145
- <!-- display 'EXAMPLE' -->
7146
- <xsl:apply-templates select="*[local-name()='name']">
7147
- <xsl:with-param name="fo_element" select="$fo_element"/>
7148
- </xsl:apply-templates>
7205
+ <fo:block-container margin-left="0mm">
7149
7206
 
7150
- <xsl:choose>
7151
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
7152
- <fo:block-container xsl:use-attribute-sets="example-body-style">
7153
- <fo:block-container margin-left="0mm" margin-right="0mm">
7154
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
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']">
7155
7214
  <xsl:with-param name="fo_element" select="$fo_element"/>
7156
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>
7157
7224
  </fo:block-container>
7158
- </fo:block-container>
7159
- </xsl:when>
7160
- <xsl:otherwise>
7161
- <fo:inline>
7162
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
7163
- <xsl:with-param name="fo_element" select="$fo_element"/>
7164
- </xsl:apply-templates>
7165
- </fo:inline>
7166
- </xsl:otherwise>
7167
- </xsl:choose>
7168
-
7169
- </fo:block>
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() &gt; 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() &gt; 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>
7170
7256
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
7171
7257
  <xsl:param name="fo_element">block</xsl:param>
7172
7258
 
@@ -7198,10 +7284,16 @@
7198
7284
  </xsl:variable>
7199
7285
  <xsl:choose>
7200
7286
  <xsl:when test="starts-with(normalize-space($element), 'block')">
7201
- <fo:block xsl:use-attribute-sets="example-p-style">
7202
-
7203
- <xsl:apply-templates/>
7204
- </fo:block>
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>
7205
7297
  </xsl:when>
7206
7298
  <xsl:otherwise>
7207
7299
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -7380,7 +7472,16 @@
7380
7472
  </fo:inline>
7381
7473
  </xsl:when>
7382
7474
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
7383
- <fo:inline><xsl:apply-templates/></fo:inline>
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
+
7384
7485
  </xsl:otherwise>
7385
7486
  </xsl:choose>
7386
7487
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -7565,10 +7666,24 @@
7565
7666
 
7566
7667
  </fo:block>
7567
7668
  <xsl:apply-templates/>
7568
- </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 -->
7569
7670
  <!-- comment 2019-11-29 -->
7570
7671
  <!-- <fo:block font-weight="bold">Review:</fo:block>
7571
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
+
7572
7687
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
7573
7688
  <!-- 0xA0 to space replacement -->
7574
7689
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -7927,7 +8042,10 @@
7927
8042
  <!-- to split by '_' and other chars -->
7928
8043
  <xsl:call-template name="add-zero-spaces-java"/>
7929
8044
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7930
- <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>
7931
8049
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7932
8050
  <!-- <row>
7933
8051
  <date>05-07-2013</date>
@@ -8496,6 +8614,120 @@
8496
8614
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8497
8615
  </xsl:for-each>
8498
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>
8499
8731
  </xsl:template><xsl:template name="convertDate">
8500
8732
  <xsl:param name="date"/>
8501
8733
  <xsl:param name="format" select="'short'"/>