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
@@ -144,10 +144,7 @@
144
144
  <fo:block margin-top="6pt">URL for this OGC® document: <xsl:value-of select="$url"/></fo:block>
145
145
  </xsl:if>
146
146
 
147
- <xsl:variable name="edition" select="/ogc:ogc-standard/ogc:bibdata/ogc:edition"/>
148
- <xsl:if test="normalize-space($edition) != ''">
149
- <fo:block margin-top="6pt">Version: <xsl:value-of select="$edition"/></fo:block>
150
- </xsl:if>
147
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition[normalize-space(@language) = '']"/>
151
148
 
152
149
  <fo:block margin-top="6pt"><xsl:text>Category: </xsl:text>
153
150
  <xsl:call-template name="capitalizeWords">
@@ -371,16 +368,21 @@
371
368
  </fo:block>
372
369
  </xsl:template>
373
370
 
371
+
374
372
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
375
- <fo:block margin-bottom="12pt">
376
- <xsl:variable name="title-edition">
377
- <xsl:call-template name="getTitle">
378
- <xsl:with-param name="name" select="'title-edition'"/>
373
+ <xsl:variable name="edition" select="."/>
374
+ <xsl:if test="normalize-space($edition) != ''">
375
+ <fo:block margin-top="6pt">
376
+ <xsl:call-template name="capitalize">
377
+ <xsl:with-param name="str">
378
+ <xsl:call-template name="getLocalizedString">
379
+ <xsl:with-param name="key">version</xsl:with-param>
380
+ </xsl:call-template>
381
+ </xsl:with-param>
379
382
  </xsl:call-template>
380
- </xsl:variable>
381
- <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
382
- <xsl:value-of select="."/><xsl:text> </xsl:text>
383
- </fo:block>
383
+ <xsl:text>: </xsl:text><xsl:value-of select="$edition"/>
384
+ </fo:block>
385
+ </xsl:if>
384
386
  </xsl:template>
385
387
 
386
388
 
@@ -653,20 +655,7 @@
653
655
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
654
656
  25.4
655
657
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
656
-
657
- <title-edition lang="en">
658
-
659
- <xsl:text>Version</xsl:text>
660
-
661
- </title-edition>
662
-
663
- <title-edition lang="fr">
664
- <xsl:text>Édition </xsl:text>
665
- </title-edition>
666
658
 
667
- <title-edition lang="ru">
668
- <xsl:text>Издание </xsl:text>
669
- </title-edition>
670
659
 
671
660
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
672
661
  <title-toc lang="en">
@@ -747,7 +736,7 @@
747
736
  </xsl:variable><xsl:variable name="bibdata">
748
737
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
749
738
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
750
- </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">
739
+ </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">
751
740
  <xsl:param name="name"/>
752
741
  <xsl:param name="lang"/>
753
742
  <xsl:variable name="lang_">
@@ -795,7 +784,7 @@
795
784
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
796
785
 
797
786
  <xsl:variable name="additional_fonts_">
798
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
787
+ <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']">
799
788
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
800
789
  </xsl:for-each>
801
790
  </xsl:variable>
@@ -892,7 +881,6 @@
892
881
 
893
882
 
894
883
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
895
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
896
884
 
897
885
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
898
886
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1019,6 +1007,7 @@
1019
1007
 
1020
1008
 
1021
1009
 
1010
+
1022
1011
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1023
1012
 
1024
1013
 
@@ -2148,22 +2137,32 @@
2148
2137
  <xsl:sort select="@displayorder" data-type="number"/>
2149
2138
  <xsl:apply-templates select="."/>
2150
2139
  </xsl:for-each>
2151
- </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">
2152
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2153
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2154
- <xsl:call-template name="replace_fo_inline">
2155
- <xsl:with-param name="text" select="$text"/>
2156
- </xsl:call-template>
2157
- </xsl:template><xsl:template name="replace_fo_inline">
2140
+ </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">
2141
+
2142
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2143
+ <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))"/>
2144
+ <xsl:call-template name="replace_fo_inline_tags">
2145
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2146
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2147
+ <xsl:with-param name="text" select="$text"/>
2148
+ </xsl:call-template>
2149
+
2150
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2151
+ <xsl:param name="tag_open"/>
2152
+ <xsl:param name="tag_close"/>
2158
2153
  <xsl:param name="text"/>
2159
2154
  <xsl:choose>
2160
2155
  <xsl:when test="contains($text, $tag_open)">
2161
2156
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2162
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2157
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2163
2158
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2164
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2165
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2166
- <xsl:call-template name="replace_fo_inline">
2159
+ <fo:inline keep-together.within-line="always">
2160
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2161
+ </fo:inline>
2162
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2163
+ <xsl:call-template name="replace_fo_inline_tags">
2164
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2165
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2167
2166
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2168
2167
  </xsl:call-template>
2169
2168
  </xsl:when>
@@ -2171,6 +2170,8 @@
2171
2170
  </xsl:choose>
2172
2171
  </xsl:template><xsl:template match="*[local-name()='br']">
2173
2172
  <xsl:value-of select="$linebreak"/>
2173
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2174
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2174
2175
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2175
2176
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2176
2177
  <xsl:apply-templates/>
@@ -2278,11 +2279,24 @@
2278
2279
  <xsl:with-param name="margin" select="$margin"/>
2279
2280
  </xsl:call-template>
2280
2281
 
2281
- </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">
2282
-
2283
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2284
- <xsl:call-template name="add-zero-spaces-java"/>
2285
-
2282
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2283
+ <xsl:choose>
2284
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2285
+ <xsl:value-of select="."/>
2286
+ </xsl:when>
2287
+ <xsl:otherwise>
2288
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2289
+ </xsl:otherwise>
2290
+ </xsl:choose>
2291
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2292
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2293
+ <!-- <xsl:copy-of select="$text"/> -->
2294
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2295
+ <xsl:choose>
2296
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2297
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2298
+ </xsl:choose>
2299
+ </xsl:for-each>
2286
2300
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2287
2301
 
2288
2302
  <xsl:variable name="table-preamble">
@@ -2568,6 +2582,7 @@
2568
2582
  <xsl:with-param name="text" select="$td_text"/>
2569
2583
  </xsl:call-template>
2570
2584
  </xsl:variable>
2585
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2571
2586
  <xsl:call-template name="tokenize">
2572
2587
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2573
2588
  <!-- 2009 thinspace -->
@@ -2580,6 +2595,7 @@
2580
2595
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2581
2596
  </xsl:call-template>
2582
2597
  </xsl:variable>
2598
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2583
2599
  <width>
2584
2600
  <xsl:variable name="divider">
2585
2601
  <xsl:choose>
@@ -2612,12 +2628,10 @@
2612
2628
  <xsl:with-param name="table" select="$table"/>
2613
2629
  </xsl:call-template>
2614
2630
  </xsl:if>
2615
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
2616
- <xsl:apply-templates mode="td_text"/>
2617
- </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
2618
-
2619
- <xsl:value-of select="."/>
2620
-
2631
+ </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2632
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2633
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2634
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2621
2635
  </xsl:template><xsl:template match="text()" mode="td_text">
2622
2636
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2623
2637
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3273,8 +3287,10 @@
3273
3287
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3274
3288
  </xsl:variable>
3275
3289
 
3290
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3291
+
3276
3292
  <xsl:choose>
3277
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3293
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3278
3294
 
3279
3295
  <fo:block margin-bottom="12pt" text-align="left">
3280
3296
 
@@ -3289,7 +3305,7 @@
3289
3305
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3290
3306
  </fo:block>
3291
3307
 
3292
- </xsl:when>
3308
+ </xsl:when> <!-- END: only one component -->
3293
3309
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3294
3310
  <fo:block margin-bottom="12pt" text-align="left">
3295
3311
 
@@ -3303,8 +3319,8 @@
3303
3319
  </xsl:variable>
3304
3320
  <xsl:value-of select="$title-where"/>
3305
3321
  </fo:block>
3306
- </xsl:when>
3307
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3322
+ </xsl:when> <!-- END: a few components -->
3323
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3308
3324
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3309
3325
 
3310
3326
 
@@ -3317,11 +3333,11 @@
3317
3333
  </xsl:variable>
3318
3334
  <xsl:value-of select="$title-key"/>
3319
3335
  </fo:block>
3320
- </xsl:when>
3336
+ </xsl:when> <!-- END: definition list in a figure -->
3321
3337
  </xsl:choose>
3322
3338
 
3323
3339
  <!-- a few components -->
3324
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3340
+ <xsl:if test="$onlyOneComponent = 'false'">
3325
3341
  <fo:block>
3326
3342
 
3327
3343
 
@@ -3360,27 +3376,28 @@
3360
3376
  <xsl:apply-templates mode="dl"/>
3361
3377
  </tbody>
3362
3378
  </xsl:variable>
3363
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3379
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3364
3380
  <xsl:variable name="colwidths">
3365
3381
  <xsl:call-template name="calculate-column-widths">
3366
3382
  <xsl:with-param name="cols-count" select="2"/>
3367
3383
  <xsl:with-param name="table" select="$html-table"/>
3368
3384
  </xsl:call-template>
3369
3385
  </xsl:variable>
3370
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3386
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3371
3387
  <xsl:variable name="maxlength_dt">
3372
3388
  <xsl:call-template name="getMaxLength_dt"/>
3373
3389
  </xsl:variable>
3374
- <xsl:variable name="isContainsExpressReference_">
3390
+ <xsl:variable name="isContainsKeepTogetherTag_">
3375
3391
  false
3376
3392
  </xsl:variable>
3377
- <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
3393
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3378
3394
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3379
3395
  <xsl:call-template name="setColumnWidth_dl">
3380
3396
  <xsl:with-param name="colwidths" select="$colwidths"/>
3381
3397
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3382
- <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
3398
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3383
3399
  </xsl:call-template>
3400
+
3384
3401
  <fo:table-body>
3385
3402
  <xsl:apply-templates>
3386
3403
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3389,13 +3406,13 @@
3389
3406
  </fo:table>
3390
3407
  </fo:block>
3391
3408
  </fo:block>
3392
- </xsl:if>
3409
+ </xsl:if> <!-- END: a few components -->
3393
3410
  </fo:block-container>
3394
3411
  </fo:block-container>
3395
3412
  </xsl:template><xsl:template name="setColumnWidth_dl">
3396
3413
  <xsl:param name="colwidths"/>
3397
3414
  <xsl:param name="maxlength_dt"/>
3398
- <xsl:param name="isContainsExpressReference"/>
3415
+ <xsl:param name="isContainsKeepTogetherTag"/>
3399
3416
  <xsl:choose>
3400
3417
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3401
3418
  <fo:table-column column-width="50%"/>
@@ -3403,7 +3420,7 @@
3403
3420
  </xsl:when>
3404
3421
  <xsl:otherwise>
3405
3422
  <xsl:choose>
3406
- <xsl:when test="$isContainsExpressReference">
3423
+ <xsl:when test="$isContainsKeepTogetherTag">
3407
3424
  <xsl:call-template name="insertTableColumnWidth">
3408
3425
  <xsl:with-param name="colwidths" select="$colwidths"/>
3409
3426
  </xsl:call-template>
@@ -3480,7 +3497,6 @@
3480
3497
  <xsl:value-of select="$maxLength"/>
3481
3498
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3482
3499
  <xsl:param name="key_iso"/>
3483
-
3484
3500
  <!-- <tr>
3485
3501
  <td>NOTE</td>
3486
3502
  <td>
@@ -3488,18 +3504,30 @@
3488
3504
  </td>
3489
3505
  </tr>
3490
3506
  -->
3491
- <fo:table-row>
3507
+ <!-- OLD Variant -->
3508
+ <!-- <fo:table-row>
3492
3509
  <fo:table-cell>
3493
3510
  <fo:block margin-top="6pt">
3494
3511
  <xsl:if test="normalize-space($key_iso) = 'true'">
3495
3512
  <xsl:attribute name="margin-top">0</xsl:attribute>
3496
3513
  </xsl:if>
3497
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3514
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3498
3515
  </fo:block>
3499
3516
  </fo:table-cell>
3500
3517
  <fo:table-cell>
3501
3518
  <fo:block>
3502
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3519
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3520
+ </fo:block>
3521
+ </fo:table-cell>
3522
+ </fo:table-row> -->
3523
+ <!-- <tr>
3524
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3525
+ </tr>
3526
+ -->
3527
+ <fo:table-row>
3528
+ <fo:table-cell number-columns-spanned="2">
3529
+ <fo:block>
3530
+ <xsl:call-template name="note"/>
3503
3531
  </fo:block>
3504
3532
  </fo:table-cell>
3505
3533
  </fo:table-row>
@@ -3601,13 +3629,15 @@
3601
3629
  <xsl:choose>
3602
3630
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3603
3631
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3604
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3632
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3605
3633
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3606
3634
  </xsl:choose>
3607
3635
  </xsl:attribute>
3608
3636
  </xsl:if>
3609
3637
  <xsl:apply-templates/>
3610
3638
  </fo:inline>
3639
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
3640
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3611
3641
  </xsl:template><xsl:template match="*[local-name()='underline']">
3612
3642
  <fo:inline text-decoration="underline">
3613
3643
  <xsl:apply-templates/>
@@ -3755,41 +3785,50 @@
3755
3785
  <fo:block break-after="page"/>
3756
3786
  <fo:block> </fo:block>
3757
3787
  <fo:block break-after="page"/>
3788
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
3789
+ <xsl:apply-templates/>
3758
3790
  </xsl:template><xsl:template name="tokenize">
3759
3791
  <xsl:param name="text"/>
3760
3792
  <xsl:param name="separator" select="' '"/>
3761
3793
  <xsl:choose>
3762
3794
  <xsl:when test="not(contains($text, $separator))">
3763
3795
  <word>
3764
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3765
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3766
3796
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3767
- <xsl:variable name="len_str">
3768
- <xsl:choose>
3769
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3770
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3771
- </xsl:when>
3772
- <xsl:otherwise>
3773
- <xsl:value-of select="$len_str_tmp"/>
3774
- </xsl:otherwise>
3775
- </xsl:choose>
3776
- </xsl:variable>
3777
-
3778
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3779
- <xsl:message>
3780
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3781
- len_str=<xsl:value-of select="$len_str"/>
3782
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3783
- </xsl:message>
3784
- </xsl:if> -->
3785
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3786
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3787
3797
  <xsl:choose>
3788
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3789
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3798
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
3799
+ <xsl:value-of select="$len_str_tmp"/>
3790
3800
  </xsl:when>
3791
3801
  <xsl:otherwise>
3792
- <xsl:value-of select="$len_str"/>
3802
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3803
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3804
+ <xsl:variable name="len_str">
3805
+ <xsl:choose>
3806
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3807
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
3808
+ </xsl:when>
3809
+ <xsl:otherwise>
3810
+ <xsl:value-of select="$len_str_tmp"/>
3811
+ </xsl:otherwise>
3812
+ </xsl:choose>
3813
+ </xsl:variable>
3814
+
3815
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3816
+ <xsl:message>
3817
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3818
+ len_str=<xsl:value-of select="$len_str"/>
3819
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3820
+ </xsl:message>
3821
+ </xsl:if> -->
3822
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3823
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
3824
+ <xsl:choose>
3825
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3826
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3827
+ </xsl:when>
3828
+ <xsl:otherwise>
3829
+ <xsl:value-of select="$len_str"/>
3830
+ </xsl:otherwise>
3831
+ </xsl:choose>
3793
3832
  </xsl:otherwise>
3794
3833
  </xsl:choose>
3795
3834
  </word>
@@ -4178,7 +4217,9 @@
4178
4217
  <!-- replace start and end spaces to non-break space -->
4179
4218
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4180
4219
  </xsl:copy>
4181
- </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">
4220
+ </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">
4221
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
4222
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4182
4223
  <xsl:variable name="target">
4183
4224
  <xsl:choose>
4184
4225
  <xsl:when test="@updatetype = 'true'">
@@ -4996,7 +5037,11 @@
4996
5037
  <xsl:apply-templates mode="bookmarks"/>
4997
5038
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4998
5039
  <xsl:apply-templates select="."/>
4999
- </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">
5040
+ </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">
5041
+ <xsl:apply-templates mode="contents"/>
5042
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5043
+ <xsl:apply-templates mode="bookmarks"/>
5044
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
5000
5045
  <xsl:apply-templates mode="bookmarks"/>
5001
5046
  </xsl:template><xsl:template name="addBookmarks">
5002
5047
  <xsl:param name="contents"/>
@@ -5267,7 +5312,9 @@
5267
5312
  <xsl:apply-templates/>
5268
5313
  </xsl:otherwise>
5269
5314
  </xsl:choose>
5270
- </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">
5315
+ </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">
5316
+ <xsl:value-of select="."/>
5317
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5271
5318
  <xsl:text> </xsl:text>
5272
5319
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5273
5320
  <xsl:copy>
@@ -5298,9 +5345,22 @@
5298
5345
  </xsl:when>
5299
5346
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5300
5347
  </xsl:choose>
5348
+ </xsl:template><xsl:template match="text()" mode="contents_item">
5349
+ <xsl:call-template name="keep_together_standard_number"/>
5350
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
5351
+ <xsl:apply-templates mode="contents_item"/>
5301
5352
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5302
5353
 
5303
5354
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
5355
+
5356
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
5357
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5358
+ </xsl:if>
5359
+
5360
+ <xsl:if test="ancestor::*[local-name() = 'example']">
5361
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5362
+ </xsl:if>
5363
+
5304
5364
  <xsl:copy-of select="@id"/>
5305
5365
 
5306
5366
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5788,39 +5848,67 @@
5788
5848
  </xsl:otherwise>
5789
5849
  </xsl:choose>
5790
5850
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5791
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5792
-
5851
+
5852
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
5853
+
5793
5854
 
5855
+
5794
5856
  <xsl:variable name="fo_element">
5795
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
5857
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5796
5858
  block
5797
5859
  </xsl:variable>
5798
5860
 
5799
- <!-- display 'EXAMPLE' -->
5800
- <xsl:apply-templates select="*[local-name()='name']">
5801
- <xsl:with-param name="fo_element" select="$fo_element"/>
5802
- </xsl:apply-templates>
5861
+ <fo:block-container margin-left="0mm">
5803
5862
 
5804
- <xsl:choose>
5805
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5806
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5807
- <fo:block-container margin-left="0mm" margin-right="0mm">
5808
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5863
+ <xsl:choose>
5864
+
5865
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5866
+
5867
+ <!-- display name 'EXAMPLE' in a separate block -->
5868
+ <fo:block>
5869
+ <xsl:apply-templates select="*[local-name()='name']">
5809
5870
  <xsl:with-param name="fo_element" select="$fo_element"/>
5810
5871
  </xsl:apply-templates>
5872
+ </fo:block>
5873
+
5874
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5875
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5876
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5877
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5878
+ </xsl:apply-templates>
5879
+ </fo:block-container>
5811
5880
  </fo:block-container>
5812
- </fo:block-container>
5813
- </xsl:when>
5814
- <xsl:otherwise>
5815
- <fo:inline>
5816
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5817
- <xsl:with-param name="fo_element" select="$fo_element"/>
5818
- </xsl:apply-templates>
5819
- </fo:inline>
5820
- </xsl:otherwise>
5821
- </xsl:choose>
5822
-
5823
- </fo:block>
5881
+ </xsl:when> <!-- end block -->
5882
+
5883
+ <xsl:otherwise> <!-- inline -->
5884
+
5885
+ <!-- display 'EXAMPLE' and first element in the same line -->
5886
+ <fo:block>
5887
+ <xsl:apply-templates select="*[local-name()='name']">
5888
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5889
+ </xsl:apply-templates>
5890
+ <fo:inline>
5891
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
5892
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5893
+ </xsl:apply-templates>
5894
+ </fo:inline>
5895
+ </fo:block>
5896
+
5897
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
5898
+ <!-- display further elements in blocks -->
5899
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5900
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5901
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
5902
+ <xsl:with-param name="fo_element" select="'block'"/>
5903
+ </xsl:apply-templates>
5904
+ </fo:block-container>
5905
+ </fo:block-container>
5906
+ </xsl:if>
5907
+ </xsl:otherwise> <!-- end inline -->
5908
+
5909
+ </xsl:choose>
5910
+ </fo:block-container>
5911
+ </fo:block-container>
5824
5912
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5825
5913
  <xsl:param name="fo_element">block</xsl:param>
5826
5914
 
@@ -5852,10 +5940,16 @@
5852
5940
  </xsl:variable>
5853
5941
  <xsl:choose>
5854
5942
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5855
- <fo:block xsl:use-attribute-sets="example-p-style">
5856
-
5857
- <xsl:apply-templates/>
5858
- </fo:block>
5943
+ <fo:block-container>
5944
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
5945
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5946
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5947
+ </xsl:if>
5948
+ <fo:block xsl:use-attribute-sets="example-p-style">
5949
+
5950
+ <xsl:apply-templates/>
5951
+ </fo:block>
5952
+ </fo:block-container>
5859
5953
  </xsl:when>
5860
5954
  <xsl:otherwise>
5861
5955
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -6037,7 +6131,16 @@
6037
6131
  </fo:inline>
6038
6132
  </xsl:when>
6039
6133
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6040
- <fo:inline><xsl:apply-templates/></fo:inline>
6134
+
6135
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6136
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6137
+ <xsl:choose>
6138
+ <xsl:when test="$uri_src != ''">
6139
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6140
+ </xsl:when>
6141
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6142
+ </xsl:choose>
6143
+
6041
6144
  </xsl:otherwise>
6042
6145
  </xsl:choose>
6043
6146
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6222,10 +6325,24 @@
6222
6325
 
6223
6326
  </fo:block>
6224
6327
  <xsl:apply-templates/>
6225
- </xsl:template><xsl:template match="*[local-name() = 'review']">
6328
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
6226
6329
  <!-- comment 2019-11-29 -->
6227
6330
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6228
6331
  <xsl:apply-templates /> -->
6332
+
6333
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
6334
+
6335
+ <xsl:choose>
6336
+ <!-- if there isn't the attribute '@from', then -->
6337
+ <xsl:when test="$id_from = ''">
6338
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6339
+ </xsl:when>
6340
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
6341
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
6342
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6343
+ </xsl:when>
6344
+ </xsl:choose>
6345
+
6229
6346
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6230
6347
  <!-- 0xA0 to space replacement -->
6231
6348
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6582,7 +6699,10 @@
6582
6699
  <!-- to split by '_' and other chars -->
6583
6700
  <xsl:call-template name="add-zero-spaces-java"/>
6584
6701
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6585
- <fo:inline id="{@id}" font-size="1pt"/>
6702
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6703
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6704
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6705
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
6586
6706
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6587
6707
  <!-- <row>
6588
6708
  <date>05-07-2013</date>
@@ -7250,6 +7370,120 @@
7250
7370
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7251
7371
  </xsl:for-each>
7252
7372
  </xsl:copy>
7373
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
7374
+ <xsl:apply-templates mode="update_xml_step1"/>
7375
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
7376
+ <xsl:copy>
7377
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
7378
+ </xsl:copy>
7379
+ </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">
7380
+
7381
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
7382
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
7383
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7384
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7385
+ <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))"/>
7386
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
7387
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7388
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7389
+ <xsl:with-param name="text" select="$text_"/>
7390
+ </xsl:call-template></text></xsl:variable>
7391
+
7392
+ <xsl:variable name="parent" select="local-name(..)"/>
7393
+
7394
+ <xsl:variable name="text2">
7395
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
7396
+ <xsl:copy-of select="."/>
7397
+ </xsl:for-each></text>
7398
+ </xsl:variable>
7399
+
7400
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
7401
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
7402
+ <xsl:variable name="text3">
7403
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
7404
+ <xsl:choose>
7405
+ <xsl:when test="self::text()">
7406
+ <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))"/>
7407
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
7408
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7409
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7410
+ <xsl:with-param name="text" select="$text_units_"/>
7411
+ </xsl:call-template></text></xsl:variable>
7412
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
7413
+ </xsl:when>
7414
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7415
+ </xsl:choose>
7416
+ </xsl:for-each></text>
7417
+ </xsl:variable>
7418
+
7419
+ <xsl:choose>
7420
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
7421
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
7422
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
7423
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
7424
+ <xsl:choose>
7425
+ <xsl:when test="self::text()">
7426
+ <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))"/>
7427
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
7428
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7429
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7430
+ <xsl:with-param name="text" select="$text_dots_"/>
7431
+ </xsl:call-template></text></xsl:variable>
7432
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
7433
+ </xsl:when>
7434
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7435
+ </xsl:choose>
7436
+ </xsl:for-each>
7437
+ </xsl:when>
7438
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
7439
+ </xsl:choose>
7440
+
7441
+ </xsl:template><xsl:template name="replace_text_tags">
7442
+ <xsl:param name="tag_open"/>
7443
+ <xsl:param name="tag_close"/>
7444
+ <xsl:param name="text"/>
7445
+ <xsl:choose>
7446
+ <xsl:when test="contains($text, $tag_open)">
7447
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
7448
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
7449
+
7450
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
7451
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
7452
+ </xsl:element>
7453
+
7454
+ <xsl:call-template name="replace_text_tags">
7455
+ <xsl:with-param name="tag_open" select="$tag_open"/>
7456
+ <xsl:with-param name="tag_close" select="$tag_close"/>
7457
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
7458
+ </xsl:call-template>
7459
+ </xsl:when>
7460
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7461
+ </xsl:choose>
7462
+ </xsl:template><xsl:template name="printEdition">
7463
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7464
+ <xsl:text> </xsl:text>
7465
+ <xsl:choose>
7466
+ <xsl:when test="$edition_i18n != ''">
7467
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
7468
+ <xsl:call-template name="capitalize">
7469
+ <xsl:with-param name="str" select="$edition_i18n"/>
7470
+ </xsl:call-template>
7471
+ </xsl:when>
7472
+ <xsl:otherwise>
7473
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
7474
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
7475
+ <xsl:call-template name="capitalize">
7476
+ <xsl:with-param name="str">
7477
+ <xsl:call-template name="getLocalizedString">
7478
+ <xsl:with-param name="key">edition</xsl:with-param>
7479
+ </xsl:call-template>
7480
+ </xsl:with-param>
7481
+ </xsl:call-template>
7482
+ <xsl:text> </xsl:text>
7483
+ <xsl:value-of select="$edition"/>
7484
+ </xsl:if>
7485
+ </xsl:otherwise>
7486
+ </xsl:choose>
7253
7487
  </xsl:template><xsl:template name="convertDate">
7254
7488
  <xsl:param name="date"/>
7255
7489
  <xsl:param name="format" select="'short'"/>