metanorma-ogc 2.0.8.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/biblio.rb +1 -134
  3. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -0
  4. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +3 -0
  5. data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +3 -0
  6. data/lib/isodoc/ogc/init.rb +5 -6
  7. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +357 -121
  8. data/lib/isodoc/ogc/ogc.best-practice.xsl +357 -121
  9. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +357 -121
  10. data/lib/isodoc/ogc/ogc.community-practice.xsl +357 -121
  11. data/lib/isodoc/ogc/ogc.community-standard.xsl +357 -121
  12. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +357 -121
  13. data/lib/isodoc/ogc/ogc.engineering-report.xsl +357 -121
  14. data/lib/isodoc/ogc/ogc.other.xsl +357 -121
  15. data/lib/isodoc/ogc/ogc.policy.xsl +357 -121
  16. data/lib/isodoc/ogc/ogc.reference-model.xsl +357 -121
  17. data/lib/isodoc/ogc/ogc.release-notes.xsl +357 -121
  18. data/lib/isodoc/ogc/ogc.standard.xsl +357 -121
  19. data/lib/isodoc/ogc/ogc.test-suite.xsl +357 -121
  20. data/lib/isodoc/ogc/ogc.user-guide.xsl +357 -121
  21. data/lib/isodoc/ogc/ogc.white-paper.xsl +362 -128
  22. data/lib/isodoc/ogc/presentation_xml_convert.rb +13 -9
  23. data/lib/isodoc/ogc/word_convert.rb +2 -3
  24. data/lib/isodoc/ogc/xref.rb +6 -2
  25. data/lib/metanorma/ogc/biblio.rng +37 -8
  26. data/lib/metanorma/ogc/isodoc.rng +56 -0
  27. data/lib/metanorma/ogc/version.rb +1 -1
  28. data/lib/relaton/render/config.yml +10 -0
  29. data/lib/relaton/render/date.rb +9 -0
  30. data/lib/relaton/render/fields.rb +23 -0
  31. data/lib/relaton/render/general.rb +25 -0
  32. data/lib/relaton/render/parse.rb +11 -0
  33. data/metanorma-ogc.gemspec +1 -1
  34. metadata +9 -4
@@ -295,7 +295,7 @@
295
295
 
296
296
  <fo:block-container absolute-position="fixed" left="16.5mm" top="204mm" height="60mm" width="180mm" display-align="after" font-size="10pt">
297
297
  <fo:block line-height="140%">
298
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition"/>
298
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition[normalize-space(@language) = '']"/>
299
299
  <fo:block>
300
300
  <fo:inline font-weight="bold">Submission Date: </fo:inline>
301
301
  <xsl:choose>
@@ -799,12 +799,16 @@
799
799
 
800
800
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
801
801
  <fo:block>
802
- <xsl:variable name="title-edition">
803
- <xsl:call-template name="getTitle">
804
- <xsl:with-param name="name" select="'title-edition'"/>
802
+ <xsl:variable name="title-version">
803
+ <xsl:call-template name="capitalize">
804
+ <xsl:with-param name="str">
805
+ <xsl:call-template name="getLocalizedString">
806
+ <xsl:with-param name="key">version</xsl:with-param>
807
+ </xsl:call-template>
808
+ </xsl:with-param>
805
809
  </xsl:call-template>
806
810
  </xsl:variable>
807
- <fo:inline font-weight="bold"><xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text></fo:inline>
811
+ <fo:inline font-weight="bold"><xsl:value-of select="$title-version"/><xsl:text>: </xsl:text></fo:inline>
808
812
  <xsl:value-of select="."/><xsl:text/>
809
813
  </fo:block>
810
814
  </xsl:template>
@@ -1472,20 +1476,7 @@
1472
1476
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1473
1477
  22.5
1474
1478
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1475
-
1476
- <title-edition lang="en">
1477
-
1478
- <xsl:text>Version</xsl:text>
1479
-
1480
- </title-edition>
1481
-
1482
- <title-edition lang="fr">
1483
- <xsl:text>Édition </xsl:text>
1484
- </title-edition>
1485
1479
 
1486
- <title-edition lang="ru">
1487
- <xsl:text>Издание </xsl:text>
1488
- </title-edition>
1489
1480
 
1490
1481
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1491
1482
  <title-toc lang="en">
@@ -1566,7 +1557,7 @@
1566
1557
  </xsl:variable><xsl:variable name="bibdata">
1567
1558
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1568
1559
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1569
- </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">
1560
+ </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">
1570
1561
  <xsl:param name="name"/>
1571
1562
  <xsl:param name="lang"/>
1572
1563
  <xsl:variable name="lang_">
@@ -1615,7 +1606,7 @@
1615
1606
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1616
1607
 
1617
1608
  <xsl:variable name="additional_fonts_">
1618
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1609
+ <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']">
1619
1610
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1620
1611
  </xsl:for-each>
1621
1612
  </xsl:variable>
@@ -1713,7 +1704,6 @@
1713
1704
 
1714
1705
 
1715
1706
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
1716
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1717
1707
 
1718
1708
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1719
1709
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1838,6 +1828,7 @@
1838
1828
 
1839
1829
 
1840
1830
 
1831
+
1841
1832
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1842
1833
 
1843
1834
 
@@ -2959,22 +2950,32 @@
2959
2950
  <xsl:sort select="@displayorder" data-type="number"/>
2960
2951
  <xsl:apply-templates select="."/>
2961
2952
  </xsl:for-each>
2962
- </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">
2963
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2964
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2965
- <xsl:call-template name="replace_fo_inline">
2966
- <xsl:with-param name="text" select="$text"/>
2967
- </xsl:call-template>
2968
- </xsl:template><xsl:template name="replace_fo_inline">
2953
+ </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">
2954
+
2955
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2956
+ <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))"/>
2957
+ <xsl:call-template name="replace_fo_inline_tags">
2958
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2959
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2960
+ <xsl:with-param name="text" select="$text"/>
2961
+ </xsl:call-template>
2962
+
2963
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2964
+ <xsl:param name="tag_open"/>
2965
+ <xsl:param name="tag_close"/>
2969
2966
  <xsl:param name="text"/>
2970
2967
  <xsl:choose>
2971
2968
  <xsl:when test="contains($text, $tag_open)">
2972
2969
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2973
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2970
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2974
2971
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2975
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2976
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2977
- <xsl:call-template name="replace_fo_inline">
2972
+ <fo:inline keep-together.within-line="always">
2973
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2974
+ </fo:inline>
2975
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2976
+ <xsl:call-template name="replace_fo_inline_tags">
2977
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2978
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2978
2979
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2979
2980
  </xsl:call-template>
2980
2981
  </xsl:when>
@@ -2982,6 +2983,8 @@
2982
2983
  </xsl:choose>
2983
2984
  </xsl:template><xsl:template match="*[local-name()='br']">
2984
2985
  <xsl:value-of select="$linebreak"/>
2986
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2987
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2985
2988
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2986
2989
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2987
2990
  <xsl:apply-templates/>
@@ -3066,11 +3069,24 @@
3066
3069
  <xsl:apply-templates/>
3067
3070
  </fo:block>
3068
3071
 
3069
- </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">
3070
-
3071
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3072
- <xsl:call-template name="add-zero-spaces-java"/>
3073
-
3072
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3073
+ <xsl:choose>
3074
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
3075
+ <xsl:value-of select="."/>
3076
+ </xsl:when>
3077
+ <xsl:otherwise>
3078
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
3079
+ </xsl:otherwise>
3080
+ </xsl:choose>
3081
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
3082
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
3083
+ <!-- <xsl:copy-of select="$text"/> -->
3084
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
3085
+ <xsl:choose>
3086
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
3087
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
3088
+ </xsl:choose>
3089
+ </xsl:for-each>
3074
3090
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3075
3091
 
3076
3092
  <xsl:variable name="table-preamble">
@@ -3362,6 +3378,7 @@
3362
3378
  <xsl:with-param name="text" select="$td_text"/>
3363
3379
  </xsl:call-template>
3364
3380
  </xsl:variable>
3381
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
3365
3382
  <xsl:call-template name="tokenize">
3366
3383
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3367
3384
  <!-- 2009 thinspace -->
@@ -3374,6 +3391,7 @@
3374
3391
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
3375
3392
  </xsl:call-template>
3376
3393
  </xsl:variable>
3394
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
3377
3395
  <width>
3378
3396
  <xsl:variable name="divider">
3379
3397
  <xsl:choose>
@@ -3406,12 +3424,10 @@
3406
3424
  <xsl:with-param name="table" select="$table"/>
3407
3425
  </xsl:call-template>
3408
3426
  </xsl:if>
3409
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3410
- <xsl:apply-templates mode="td_text"/>
3411
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3412
-
3413
- <xsl:value-of select="."/>
3414
-
3427
+ </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
3428
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
3429
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
3430
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
3415
3431
  </xsl:template><xsl:template match="text()" mode="td_text">
3416
3432
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3417
3433
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -4072,8 +4088,10 @@
4072
4088
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
4073
4089
  </xsl:variable>
4074
4090
 
4091
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
4092
+
4075
4093
  <xsl:choose>
4076
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
4094
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
4077
4095
 
4078
4096
  <fo:block margin-bottom="12pt" text-align="left">
4079
4097
 
@@ -4088,7 +4106,7 @@
4088
4106
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4089
4107
  </fo:block>
4090
4108
 
4091
- </xsl:when>
4109
+ </xsl:when> <!-- END: only one component -->
4092
4110
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4093
4111
  <fo:block margin-bottom="12pt" text-align="left">
4094
4112
 
@@ -4102,8 +4120,8 @@
4102
4120
  </xsl:variable>
4103
4121
  <xsl:value-of select="$title-where"/>
4104
4122
  </fo:block>
4105
- </xsl:when>
4106
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
4123
+ </xsl:when> <!-- END: a few components -->
4124
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
4107
4125
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4108
4126
 
4109
4127
 
@@ -4116,11 +4134,11 @@
4116
4134
  </xsl:variable>
4117
4135
  <xsl:value-of select="$title-key"/>
4118
4136
  </fo:block>
4119
- </xsl:when>
4137
+ </xsl:when> <!-- END: definition list in a figure -->
4120
4138
  </xsl:choose>
4121
4139
 
4122
4140
  <!-- a few components -->
4123
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
4141
+ <xsl:if test="$onlyOneComponent = 'false'">
4124
4142
  <fo:block>
4125
4143
 
4126
4144
 
@@ -4159,27 +4177,28 @@
4159
4177
  <xsl:apply-templates mode="dl"/>
4160
4178
  </tbody>
4161
4179
  </xsl:variable>
4162
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
4180
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4163
4181
  <xsl:variable name="colwidths">
4164
4182
  <xsl:call-template name="calculate-column-widths">
4165
4183
  <xsl:with-param name="cols-count" select="2"/>
4166
4184
  <xsl:with-param name="table" select="$html-table"/>
4167
4185
  </xsl:call-template>
4168
4186
  </xsl:variable>
4169
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4187
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4170
4188
  <xsl:variable name="maxlength_dt">
4171
4189
  <xsl:call-template name="getMaxLength_dt"/>
4172
4190
  </xsl:variable>
4173
- <xsl:variable name="isContainsExpressReference_">
4191
+ <xsl:variable name="isContainsKeepTogetherTag_">
4174
4192
  false
4175
4193
  </xsl:variable>
4176
- <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4194
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4177
4195
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4178
4196
  <xsl:call-template name="setColumnWidth_dl">
4179
4197
  <xsl:with-param name="colwidths" select="$colwidths"/>
4180
4198
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4181
- <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4199
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4182
4200
  </xsl:call-template>
4201
+
4183
4202
  <fo:table-body>
4184
4203
  <xsl:apply-templates>
4185
4204
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4188,13 +4207,13 @@
4188
4207
  </fo:table>
4189
4208
  </fo:block>
4190
4209
  </fo:block>
4191
- </xsl:if>
4210
+ </xsl:if> <!-- END: a few components -->
4192
4211
  </fo:block-container>
4193
4212
  </fo:block-container>
4194
4213
  </xsl:template><xsl:template name="setColumnWidth_dl">
4195
4214
  <xsl:param name="colwidths"/>
4196
4215
  <xsl:param name="maxlength_dt"/>
4197
- <xsl:param name="isContainsExpressReference"/>
4216
+ <xsl:param name="isContainsKeepTogetherTag"/>
4198
4217
  <xsl:choose>
4199
4218
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4200
4219
  <fo:table-column column-width="50%"/>
@@ -4202,7 +4221,7 @@
4202
4221
  </xsl:when>
4203
4222
  <xsl:otherwise>
4204
4223
  <xsl:choose>
4205
- <xsl:when test="$isContainsExpressReference">
4224
+ <xsl:when test="$isContainsKeepTogetherTag">
4206
4225
  <xsl:call-template name="insertTableColumnWidth">
4207
4226
  <xsl:with-param name="colwidths" select="$colwidths"/>
4208
4227
  </xsl:call-template>
@@ -4279,7 +4298,6 @@
4279
4298
  <xsl:value-of select="$maxLength"/>
4280
4299
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
4281
4300
  <xsl:param name="key_iso"/>
4282
-
4283
4301
  <!-- <tr>
4284
4302
  <td>NOTE</td>
4285
4303
  <td>
@@ -4287,18 +4305,30 @@
4287
4305
  </td>
4288
4306
  </tr>
4289
4307
  -->
4290
- <fo:table-row>
4308
+ <!-- OLD Variant -->
4309
+ <!-- <fo:table-row>
4291
4310
  <fo:table-cell>
4292
4311
  <fo:block margin-top="6pt">
4293
4312
  <xsl:if test="normalize-space($key_iso) = 'true'">
4294
4313
  <xsl:attribute name="margin-top">0</xsl:attribute>
4295
4314
  </xsl:if>
4296
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4315
+ <xsl:apply-templates select="*[local-name() = 'name']" />
4297
4316
  </fo:block>
4298
4317
  </fo:table-cell>
4299
4318
  <fo:table-cell>
4300
4319
  <fo:block>
4301
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4320
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
4321
+ </fo:block>
4322
+ </fo:table-cell>
4323
+ </fo:table-row> -->
4324
+ <!-- <tr>
4325
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
4326
+ </tr>
4327
+ -->
4328
+ <fo:table-row>
4329
+ <fo:table-cell number-columns-spanned="2">
4330
+ <fo:block>
4331
+ <xsl:call-template name="note"/>
4302
4332
  </fo:block>
4303
4333
  </fo:table-cell>
4304
4334
  </fo:table-row>
@@ -4400,13 +4430,15 @@
4400
4430
  <xsl:choose>
4401
4431
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4402
4432
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4403
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4433
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4404
4434
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4405
4435
  </xsl:choose>
4406
4436
  </xsl:attribute>
4407
4437
  </xsl:if>
4408
4438
  <xsl:apply-templates/>
4409
4439
  </fo:inline>
4440
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4441
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4410
4442
  </xsl:template><xsl:template match="*[local-name()='underline']">
4411
4443
  <fo:inline text-decoration="underline">
4412
4444
  <xsl:apply-templates/>
@@ -4554,41 +4586,50 @@
4554
4586
  <fo:block break-after="page"/>
4555
4587
  <fo:block> </fo:block>
4556
4588
  <fo:block break-after="page"/>
4589
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4590
+ <xsl:apply-templates/>
4557
4591
  </xsl:template><xsl:template name="tokenize">
4558
4592
  <xsl:param name="text"/>
4559
4593
  <xsl:param name="separator" select="' '"/>
4560
4594
  <xsl:choose>
4561
4595
  <xsl:when test="not(contains($text, $separator))">
4562
4596
  <word>
4563
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4564
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4565
4597
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
4566
- <xsl:variable name="len_str">
4567
- <xsl:choose>
4568
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4569
- <xsl:value-of select="$len_str_tmp * 1.5"/>
4570
- </xsl:when>
4571
- <xsl:otherwise>
4572
- <xsl:value-of select="$len_str_tmp"/>
4573
- </xsl:otherwise>
4574
- </xsl:choose>
4575
- </xsl:variable>
4576
-
4577
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4578
- <xsl:message>
4579
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4580
- len_str=<xsl:value-of select="$len_str"/>
4581
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4582
- </xsl:message>
4583
- </xsl:if> -->
4584
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4585
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
4586
4598
  <xsl:choose>
4587
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4588
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4599
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
4600
+ <xsl:value-of select="$len_str_tmp"/>
4589
4601
  </xsl:when>
4590
4602
  <xsl:otherwise>
4591
- <xsl:value-of select="$len_str"/>
4603
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4604
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4605
+ <xsl:variable name="len_str">
4606
+ <xsl:choose>
4607
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4608
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
4609
+ </xsl:when>
4610
+ <xsl:otherwise>
4611
+ <xsl:value-of select="$len_str_tmp"/>
4612
+ </xsl:otherwise>
4613
+ </xsl:choose>
4614
+ </xsl:variable>
4615
+
4616
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4617
+ <xsl:message>
4618
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4619
+ len_str=<xsl:value-of select="$len_str"/>
4620
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4621
+ </xsl:message>
4622
+ </xsl:if> -->
4623
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4624
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
4625
+ <xsl:choose>
4626
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4627
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
4628
+ </xsl:when>
4629
+ <xsl:otherwise>
4630
+ <xsl:value-of select="$len_str"/>
4631
+ </xsl:otherwise>
4632
+ </xsl:choose>
4592
4633
  </xsl:otherwise>
4593
4634
  </xsl:choose>
4594
4635
  </word>
@@ -4977,7 +5018,9 @@
4977
5018
  <!-- replace start and end spaces to non-break space -->
4978
5019
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4979
5020
  </xsl:copy>
4980
- </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">
5021
+ </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">
5022
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5023
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4981
5024
  <xsl:variable name="target">
4982
5025
  <xsl:choose>
4983
5026
  <xsl:when test="@updatetype = 'true'">
@@ -5799,7 +5842,11 @@
5799
5842
  <xsl:apply-templates mode="bookmarks"/>
5800
5843
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5801
5844
  <xsl:apply-templates select="."/>
5802
- </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">
5845
+ </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">
5846
+ <xsl:apply-templates mode="contents"/>
5847
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5848
+ <xsl:apply-templates mode="bookmarks"/>
5849
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
5803
5850
  <xsl:apply-templates mode="bookmarks"/>
5804
5851
  </xsl:template><xsl:template name="addBookmarks">
5805
5852
  <xsl:param name="contents"/>
@@ -6094,7 +6141,9 @@
6094
6141
  <xsl:apply-templates/>
6095
6142
  </xsl:otherwise>
6096
6143
  </xsl:choose>
6097
- </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">
6144
+ </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">
6145
+ <xsl:value-of select="."/>
6146
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
6098
6147
  <xsl:text> </xsl:text>
6099
6148
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6100
6149
  <xsl:copy>
@@ -6125,9 +6174,22 @@
6125
6174
  </xsl:when>
6126
6175
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
6127
6176
  </xsl:choose>
6177
+ </xsl:template><xsl:template match="text()" mode="contents_item">
6178
+ <xsl:call-template name="keep_together_standard_number"/>
6179
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
6180
+ <xsl:apply-templates mode="contents_item"/>
6128
6181
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6129
6182
 
6130
6183
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6184
+
6185
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6186
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6187
+ </xsl:if>
6188
+
6189
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6190
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6191
+ </xsl:if>
6192
+
6131
6193
  <xsl:copy-of select="@id"/>
6132
6194
 
6133
6195
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -6627,39 +6689,67 @@
6627
6689
  </xsl:otherwise>
6628
6690
  </xsl:choose>
6629
6691
  </xsl:template><xsl:template match="*[local-name() = 'example']">
6630
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6631
-
6692
+
6693
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6694
+
6632
6695
 
6696
+
6633
6697
  <xsl:variable name="fo_element">
6634
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6698
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
6635
6699
  inline
6636
6700
  </xsl:variable>
6637
6701
 
6638
- <!-- display 'EXAMPLE' -->
6639
- <xsl:apply-templates select="*[local-name()='name']">
6640
- <xsl:with-param name="fo_element" select="$fo_element"/>
6641
- </xsl:apply-templates>
6702
+ <fo:block-container margin-left="0mm">
6642
6703
 
6643
- <xsl:choose>
6644
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
6645
- <fo:block-container xsl:use-attribute-sets="example-body-style">
6646
- <fo:block-container margin-left="0mm" margin-right="0mm">
6647
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6704
+ <xsl:choose>
6705
+
6706
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6707
+
6708
+ <!-- display name 'EXAMPLE' in a separate block -->
6709
+ <fo:block>
6710
+ <xsl:apply-templates select="*[local-name()='name']">
6648
6711
  <xsl:with-param name="fo_element" select="$fo_element"/>
6649
6712
  </xsl:apply-templates>
6713
+ </fo:block>
6714
+
6715
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6716
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6717
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6718
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6719
+ </xsl:apply-templates>
6720
+ </fo:block-container>
6650
6721
  </fo:block-container>
6651
- </fo:block-container>
6652
- </xsl:when>
6653
- <xsl:otherwise>
6654
- <fo:inline>
6655
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6656
- <xsl:with-param name="fo_element" select="$fo_element"/>
6657
- </xsl:apply-templates>
6658
- </fo:inline>
6659
- </xsl:otherwise>
6660
- </xsl:choose>
6661
-
6662
- </fo:block>
6722
+ </xsl:when> <!-- end block -->
6723
+
6724
+ <xsl:otherwise> <!-- inline -->
6725
+
6726
+ <!-- display 'EXAMPLE' and first element in the same line -->
6727
+ <fo:block>
6728
+ <xsl:apply-templates select="*[local-name()='name']">
6729
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6730
+ </xsl:apply-templates>
6731
+ <fo:inline>
6732
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
6733
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6734
+ </xsl:apply-templates>
6735
+ </fo:inline>
6736
+ </fo:block>
6737
+
6738
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
6739
+ <!-- display further elements in blocks -->
6740
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6741
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6742
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
6743
+ <xsl:with-param name="fo_element" select="'block'"/>
6744
+ </xsl:apply-templates>
6745
+ </fo:block-container>
6746
+ </fo:block-container>
6747
+ </xsl:if>
6748
+ </xsl:otherwise> <!-- end inline -->
6749
+
6750
+ </xsl:choose>
6751
+ </fo:block-container>
6752
+ </fo:block-container>
6663
6753
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6664
6754
  <xsl:param name="fo_element">block</xsl:param>
6665
6755
 
@@ -6691,10 +6781,16 @@
6691
6781
  </xsl:variable>
6692
6782
  <xsl:choose>
6693
6783
  <xsl:when test="starts-with(normalize-space($element), 'block')">
6694
- <fo:block xsl:use-attribute-sets="example-p-style">
6695
-
6696
- <xsl:apply-templates/>
6697
- </fo:block>
6784
+ <fo:block-container>
6785
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
6786
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6787
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6788
+ </xsl:if>
6789
+ <fo:block xsl:use-attribute-sets="example-p-style">
6790
+
6791
+ <xsl:apply-templates/>
6792
+ </fo:block>
6793
+ </fo:block-container>
6698
6794
  </xsl:when>
6699
6795
  <xsl:otherwise>
6700
6796
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -6873,7 +6969,16 @@
6873
6969
  </fo:inline>
6874
6970
  </xsl:when>
6875
6971
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6876
- <fo:inline><xsl:apply-templates/></fo:inline>
6972
+
6973
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6974
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6975
+ <xsl:choose>
6976
+ <xsl:when test="$uri_src != ''">
6977
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6978
+ </xsl:when>
6979
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6980
+ </xsl:choose>
6981
+
6877
6982
  </xsl:otherwise>
6878
6983
  </xsl:choose>
6879
6984
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -7049,10 +7154,24 @@
7049
7154
 
7050
7155
  </fo:block>
7051
7156
  <xsl:apply-templates/>
7052
- </xsl:template><xsl:template match="*[local-name() = 'review']">
7157
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
7053
7158
  <!-- comment 2019-11-29 -->
7054
7159
  <!-- <fo:block font-weight="bold">Review:</fo:block>
7055
7160
  <xsl:apply-templates /> -->
7161
+
7162
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
7163
+
7164
+ <xsl:choose>
7165
+ <!-- if there isn't the attribute '@from', then -->
7166
+ <xsl:when test="$id_from = ''">
7167
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7168
+ </xsl:when>
7169
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
7170
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
7171
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
7172
+ </xsl:when>
7173
+ </xsl:choose>
7174
+
7056
7175
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
7057
7176
  <!-- 0xA0 to space replacement -->
7058
7177
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -7417,7 +7536,10 @@
7417
7536
  <!-- to split by '_' and other chars -->
7418
7537
  <xsl:call-template name="add-zero-spaces-java"/>
7419
7538
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7420
- <fo:inline id="{@id}" font-size="1pt"/>
7539
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
7540
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
7541
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
7542
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
7421
7543
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7422
7544
  <!-- <row>
7423
7545
  <date>05-07-2013</date>
@@ -8084,6 +8206,120 @@
8084
8206
  <xsl:apply-templates select="." mode="update_xml_step1"/>
8085
8207
  </xsl:for-each>
8086
8208
  </xsl:copy>
8209
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8210
+ <xsl:apply-templates mode="update_xml_step1"/>
8211
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
8212
+ <xsl:copy>
8213
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
8214
+ </xsl:copy>
8215
+ </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">
8216
+
8217
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
8218
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
8219
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8220
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
8221
+ <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))"/>
8222
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
8223
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8224
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8225
+ <xsl:with-param name="text" select="$text_"/>
8226
+ </xsl:call-template></text></xsl:variable>
8227
+
8228
+ <xsl:variable name="parent" select="local-name(..)"/>
8229
+
8230
+ <xsl:variable name="text2">
8231
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
8232
+ <xsl:copy-of select="."/>
8233
+ </xsl:for-each></text>
8234
+ </xsl:variable>
8235
+
8236
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
8237
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
8238
+ <xsl:variable name="text3">
8239
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
8240
+ <xsl:choose>
8241
+ <xsl:when test="self::text()">
8242
+ <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))"/>
8243
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
8244
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8245
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8246
+ <xsl:with-param name="text" select="$text_units_"/>
8247
+ </xsl:call-template></text></xsl:variable>
8248
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
8249
+ </xsl:when>
8250
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8251
+ </xsl:choose>
8252
+ </xsl:for-each></text>
8253
+ </xsl:variable>
8254
+
8255
+ <xsl:choose>
8256
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
8257
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
8258
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
8259
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
8260
+ <xsl:choose>
8261
+ <xsl:when test="self::text()">
8262
+ <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))"/>
8263
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
8264
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
8265
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
8266
+ <xsl:with-param name="text" select="$text_dots_"/>
8267
+ </xsl:call-template></text></xsl:variable>
8268
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
8269
+ </xsl:when>
8270
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
8271
+ </xsl:choose>
8272
+ </xsl:for-each>
8273
+ </xsl:when>
8274
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
8275
+ </xsl:choose>
8276
+
8277
+ </xsl:template><xsl:template name="replace_text_tags">
8278
+ <xsl:param name="tag_open"/>
8279
+ <xsl:param name="tag_close"/>
8280
+ <xsl:param name="text"/>
8281
+ <xsl:choose>
8282
+ <xsl:when test="contains($text, $tag_open)">
8283
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
8284
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
8285
+
8286
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
8287
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
8288
+ </xsl:element>
8289
+
8290
+ <xsl:call-template name="replace_text_tags">
8291
+ <xsl:with-param name="tag_open" select="$tag_open"/>
8292
+ <xsl:with-param name="tag_close" select="$tag_close"/>
8293
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
8294
+ </xsl:call-template>
8295
+ </xsl:when>
8296
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
8297
+ </xsl:choose>
8298
+ </xsl:template><xsl:template name="printEdition">
8299
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
8300
+ <xsl:text> </xsl:text>
8301
+ <xsl:choose>
8302
+ <xsl:when test="$edition_i18n != ''">
8303
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
8304
+ <xsl:call-template name="capitalize">
8305
+ <xsl:with-param name="str" select="$edition_i18n"/>
8306
+ </xsl:call-template>
8307
+ </xsl:when>
8308
+ <xsl:otherwise>
8309
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
8310
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
8311
+ <xsl:call-template name="capitalize">
8312
+ <xsl:with-param name="str">
8313
+ <xsl:call-template name="getLocalizedString">
8314
+ <xsl:with-param name="key">edition</xsl:with-param>
8315
+ </xsl:call-template>
8316
+ </xsl:with-param>
8317
+ </xsl:call-template>
8318
+ <xsl:text> </xsl:text>
8319
+ <xsl:value-of select="$edition"/>
8320
+ </xsl:if>
8321
+ </xsl:otherwise>
8322
+ </xsl:choose>
8087
8323
  </xsl:template><xsl:template name="convertDate">
8088
8324
  <xsl:param name="date"/>
8089
8325
  <xsl:param name="format" select="'short'"/>