metanorma-ogc 2.0.7 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
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 +547 -190
  8. data/lib/isodoc/ogc/ogc.best-practice.xsl +547 -190
  9. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +547 -190
  10. data/lib/isodoc/ogc/ogc.community-practice.xsl +547 -190
  11. data/lib/isodoc/ogc/ogc.community-standard.xsl +547 -190
  12. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +547 -190
  13. data/lib/isodoc/ogc/ogc.engineering-report.xsl +547 -190
  14. data/lib/isodoc/ogc/ogc.other.xsl +547 -190
  15. data/lib/isodoc/ogc/ogc.policy.xsl +547 -190
  16. data/lib/isodoc/ogc/ogc.reference-model.xsl +547 -190
  17. data/lib/isodoc/ogc/ogc.release-notes.xsl +547 -190
  18. data/lib/isodoc/ogc/ogc.standard.xsl +547 -190
  19. data/lib/isodoc/ogc/ogc.test-suite.xsl +547 -190
  20. data/lib/isodoc/ogc/ogc.user-guide.xsl +547 -190
  21. data/lib/isodoc/ogc/ogc.white-paper.xsl +552 -197
  22. data/lib/isodoc/ogc/presentation_xml_convert.rb +15 -10
  23. data/lib/isodoc/ogc/word_convert.rb +3 -3
  24. data/lib/isodoc/ogc/xref.rb +6 -2
  25. data/lib/metanorma/ogc/biblio.rng +62 -10
  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
@@ -130,7 +130,13 @@
130
130
 
131
131
  <xsl:template match="/">
132
132
  <xsl:call-template name="namespaceCheck"/>
133
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
133
+ <fo:root xml:lang="{$lang}">
134
+ <xsl:variable name="root-style">
135
+ <root-style xsl:use-attribute-sets="root-style"/>
136
+ </xsl:variable>
137
+ <xsl:call-template name="insertRootStyle">
138
+ <xsl:with-param name="root-style" select="$root-style"/>
139
+ </xsl:call-template>
134
140
  <fo:layout-master-set>
135
141
  <!-- Cover page -->
136
142
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -289,7 +295,7 @@
289
295
 
290
296
  <fo:block-container absolute-position="fixed" left="16.5mm" top="204mm" height="60mm" width="180mm" display-align="after" font-size="10pt">
291
297
  <fo:block line-height="140%">
292
- <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) = '']"/>
293
299
  <fo:block>
294
300
  <fo:inline font-weight="bold">Submission Date: </fo:inline>
295
301
  <xsl:choose>
@@ -793,12 +799,16 @@
793
799
 
794
800
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
795
801
  <fo:block>
796
- <xsl:variable name="title-edition">
797
- <xsl:call-template name="getTitle">
798
- <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>
799
809
  </xsl:call-template>
800
810
  </xsl:variable>
801
- <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>
802
812
  <xsl:value-of select="."/><xsl:text/>
803
813
  </fo:block>
804
814
  </xsl:template>
@@ -1451,7 +1461,7 @@
1451
1461
  </fo:static-content>
1452
1462
  </xsl:template>
1453
1463
 
1454
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1464
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
1455
1465
  <xsl:call-template name="getLang"/>
1456
1466
  </xsl:variable><xsl:variable name="pageWidth_">
1457
1467
  215.9
@@ -1466,20 +1476,7 @@
1466
1476
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1467
1477
  22.5
1468
1478
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1469
-
1470
- <title-edition lang="en">
1471
-
1472
- <xsl:text>Version</xsl:text>
1473
-
1474
- </title-edition>
1475
-
1476
- <title-edition lang="fr">
1477
- <xsl:text>Édition </xsl:text>
1478
- </title-edition>
1479
1479
 
1480
- <title-edition lang="ru">
1481
- <xsl:text>Издание </xsl:text>
1482
- </title-edition>
1483
1480
 
1484
1481
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1485
1482
  <title-toc lang="en">
@@ -1560,7 +1557,7 @@
1560
1557
  </xsl:variable><xsl:variable name="bibdata">
1561
1558
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1562
1559
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1563
- </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">
1564
1561
  <xsl:param name="name"/>
1565
1562
  <xsl:param name="lang"/>
1566
1563
  <xsl:variable name="lang_">
@@ -1604,7 +1601,30 @@
1604
1601
 
1605
1602
 
1606
1603
 
1607
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
1604
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
1605
+ <xsl:param name="root-style"/>
1606
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1607
+
1608
+ <xsl:variable name="additional_fonts_">
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']">
1610
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1611
+ </xsl:for-each>
1612
+ </xsl:variable>
1613
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1614
+
1615
+ <xsl:for-each select="$root-style_/root-style/@*">
1616
+ <xsl:choose>
1617
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1618
+ <xsl:attribute name="{local-name()}">
1619
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1620
+ </xsl:attribute>
1621
+ </xsl:when>
1622
+ <xsl:otherwise>
1623
+ <xsl:copy-of select="."/>
1624
+ </xsl:otherwise>
1625
+ </xsl:choose>
1626
+ </xsl:for-each>
1627
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
1608
1628
 
1609
1629
  <xsl:attribute name="font-size">8pt</xsl:attribute>
1610
1630
  <xsl:attribute name="line-height">125%</xsl:attribute>
@@ -1684,7 +1704,6 @@
1684
1704
 
1685
1705
 
1686
1706
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
1687
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1688
1707
 
1689
1708
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1690
1709
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1809,6 +1828,7 @@
1809
1828
 
1810
1829
 
1811
1830
 
1831
+
1812
1832
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1813
1833
 
1814
1834
 
@@ -2195,7 +2215,7 @@
2195
2215
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2196
2216
 
2197
2217
 
2198
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2218
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2199
2219
 
2200
2220
 
2201
2221
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2930,22 +2950,32 @@
2930
2950
  <xsl:sort select="@displayorder" data-type="number"/>
2931
2951
  <xsl:apply-templates select="."/>
2932
2952
  </xsl:for-each>
2933
- </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">
2934
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2935
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2936
- <xsl:call-template name="replace_fo_inline">
2937
- <xsl:with-param name="text" select="$text"/>
2938
- </xsl:call-template>
2939
- </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"/>
2940
2966
  <xsl:param name="text"/>
2941
2967
  <xsl:choose>
2942
2968
  <xsl:when test="contains($text, $tag_open)">
2943
2969
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2944
- <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> -->
2945
2971
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2946
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2947
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2948
- <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"/>
2949
2979
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2950
2980
  </xsl:call-template>
2951
2981
  </xsl:when>
@@ -2953,6 +2983,8 @@
2953
2983
  </xsl:choose>
2954
2984
  </xsl:template><xsl:template match="*[local-name()='br']">
2955
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>
2956
2988
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2957
2989
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2958
2990
  <xsl:apply-templates/>
@@ -3038,8 +3070,23 @@
3038
3070
  </fo:block>
3039
3071
 
3040
3072
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3041
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3042
- <xsl:call-template name="add-zero-spaces-java"/>
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>
3043
3090
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3044
3091
 
3045
3092
  <xsl:variable name="table-preamble">
@@ -3168,16 +3215,9 @@
3168
3215
  </xsl:for-each>
3169
3216
  </xsl:when>
3170
3217
  <xsl:otherwise>
3171
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3172
- <xsl:choose>
3173
- <xsl:when test=". = 1 or . = 0">
3174
- <fo:table-column column-width="proportional-column-width(2)"/>
3175
- </xsl:when>
3176
- <xsl:otherwise>
3177
- <fo:table-column column-width="proportional-column-width({.})"/>
3178
- </xsl:otherwise>
3179
- </xsl:choose>
3180
- </xsl:for-each>
3218
+ <xsl:call-template name="insertTableColumnWidth">
3219
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3220
+ </xsl:call-template>
3181
3221
  </xsl:otherwise>
3182
3222
  </xsl:choose>
3183
3223
 
@@ -3338,6 +3378,7 @@
3338
3378
  <xsl:with-param name="text" select="$td_text"/>
3339
3379
  </xsl:call-template>
3340
3380
  </xsl:variable>
3381
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
3341
3382
  <xsl:call-template name="tokenize">
3342
3383
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3343
3384
  <!-- 2009 thinspace -->
@@ -3350,6 +3391,7 @@
3350
3391
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
3351
3392
  </xsl:call-template>
3352
3393
  </xsl:variable>
3394
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
3353
3395
  <width>
3354
3396
  <xsl:variable name="divider">
3355
3397
  <xsl:choose>
@@ -3382,6 +3424,10 @@
3382
3424
  <xsl:with-param name="table" select="$table"/>
3383
3425
  </xsl:call-template>
3384
3426
  </xsl:if>
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')"/>
3385
3431
  </xsl:template><xsl:template match="text()" mode="td_text">
3386
3432
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3387
3433
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3483,16 +3529,9 @@
3483
3529
  </xsl:for-each>
3484
3530
  </xsl:when>
3485
3531
  <xsl:otherwise>
3486
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3487
- <xsl:choose>
3488
- <xsl:when test=". = 1 or . = 0">
3489
- <fo:table-column column-width="proportional-column-width(2)"/>
3490
- </xsl:when>
3491
- <xsl:otherwise>
3492
- <fo:table-column column-width="proportional-column-width({.})"/>
3493
- </xsl:otherwise>
3494
- </xsl:choose>
3495
- </xsl:for-each>
3532
+ <xsl:call-template name="insertTableColumnWidth">
3533
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3534
+ </xsl:call-template>
3496
3535
  </xsl:otherwise>
3497
3536
  </xsl:choose>
3498
3537
 
@@ -4049,8 +4088,10 @@
4049
4088
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
4050
4089
  </xsl:variable>
4051
4090
 
4091
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
4092
+
4052
4093
  <xsl:choose>
4053
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
4094
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
4054
4095
 
4055
4096
  <fo:block margin-bottom="12pt" text-align="left">
4056
4097
 
@@ -4065,7 +4106,7 @@
4065
4106
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4066
4107
  </fo:block>
4067
4108
 
4068
- </xsl:when>
4109
+ </xsl:when> <!-- END: only one component -->
4069
4110
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4070
4111
  <fo:block margin-bottom="12pt" text-align="left">
4071
4112
 
@@ -4079,8 +4120,8 @@
4079
4120
  </xsl:variable>
4080
4121
  <xsl:value-of select="$title-where"/>
4081
4122
  </fo:block>
4082
- </xsl:when>
4083
- <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 -->
4084
4125
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4085
4126
 
4086
4127
 
@@ -4093,11 +4134,11 @@
4093
4134
  </xsl:variable>
4094
4135
  <xsl:value-of select="$title-key"/>
4095
4136
  </fo:block>
4096
- </xsl:when>
4137
+ </xsl:when> <!-- END: definition list in a figure -->
4097
4138
  </xsl:choose>
4098
4139
 
4099
4140
  <!-- a few components -->
4100
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
4141
+ <xsl:if test="$onlyOneComponent = 'false'">
4101
4142
  <fo:block>
4102
4143
 
4103
4144
 
@@ -4136,21 +4177,28 @@
4136
4177
  <xsl:apply-templates mode="dl"/>
4137
4178
  </tbody>
4138
4179
  </xsl:variable>
4139
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
4180
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
4140
4181
  <xsl:variable name="colwidths">
4141
4182
  <xsl:call-template name="calculate-column-widths">
4142
4183
  <xsl:with-param name="cols-count" select="2"/>
4143
4184
  <xsl:with-param name="table" select="$html-table"/>
4144
4185
  </xsl:call-template>
4145
4186
  </xsl:variable>
4146
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4187
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
4147
4188
  <xsl:variable name="maxlength_dt">
4148
4189
  <xsl:call-template name="getMaxLength_dt"/>
4149
4190
  </xsl:variable>
4191
+ <xsl:variable name="isContainsKeepTogetherTag_">
4192
+ false
4193
+ </xsl:variable>
4194
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4195
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4150
4196
  <xsl:call-template name="setColumnWidth_dl">
4151
4197
  <xsl:with-param name="colwidths" select="$colwidths"/>
4152
4198
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4199
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4153
4200
  </xsl:call-template>
4201
+
4154
4202
  <fo:table-body>
4155
4203
  <xsl:apply-templates>
4156
4204
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -4159,12 +4207,13 @@
4159
4207
  </fo:table>
4160
4208
  </fo:block>
4161
4209
  </fo:block>
4162
- </xsl:if>
4210
+ </xsl:if> <!-- END: a few components -->
4163
4211
  </fo:block-container>
4164
4212
  </fo:block-container>
4165
4213
  </xsl:template><xsl:template name="setColumnWidth_dl">
4166
4214
  <xsl:param name="colwidths"/>
4167
4215
  <xsl:param name="maxlength_dt"/>
4216
+ <xsl:param name="isContainsKeepTogetherTag"/>
4168
4217
  <xsl:choose>
4169
4218
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4170
4219
  <fo:table-column column-width="50%"/>
@@ -4172,6 +4221,11 @@
4172
4221
  </xsl:when>
4173
4222
  <xsl:otherwise>
4174
4223
  <xsl:choose>
4224
+ <xsl:when test="$isContainsKeepTogetherTag">
4225
+ <xsl:call-template name="insertTableColumnWidth">
4226
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4227
+ </xsl:call-template>
4228
+ </xsl:when>
4175
4229
  <!-- to set width check most wide chars like `W` -->
4176
4230
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4177
4231
  <fo:table-column column-width="7%"/>
@@ -4202,20 +4256,25 @@
4202
4256
  <fo:table-column column-width="60%"/>
4203
4257
  </xsl:when>
4204
4258
  <xsl:otherwise>
4205
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4206
- <xsl:choose>
4207
- <xsl:when test=". = 1 or . = 0">
4208
- <fo:table-column column-width="proportional-column-width(2)"/>
4209
- </xsl:when>
4210
- <xsl:otherwise>
4211
- <fo:table-column column-width="proportional-column-width({.})"/>
4212
- </xsl:otherwise>
4213
- </xsl:choose>
4214
- </xsl:for-each>
4259
+ <xsl:call-template name="insertTableColumnWidth">
4260
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4261
+ </xsl:call-template>
4215
4262
  </xsl:otherwise>
4216
4263
  </xsl:choose>
4217
4264
  </xsl:otherwise>
4218
4265
  </xsl:choose>
4266
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4267
+ <xsl:param name="colwidths"/>
4268
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4269
+ <xsl:choose>
4270
+ <xsl:when test=". = 1 or . = 0">
4271
+ <fo:table-column column-width="proportional-column-width(2)"/>
4272
+ </xsl:when>
4273
+ <xsl:otherwise>
4274
+ <fo:table-column column-width="proportional-column-width({.})"/>
4275
+ </xsl:otherwise>
4276
+ </xsl:choose>
4277
+ </xsl:for-each>
4219
4278
  </xsl:template><xsl:template name="getMaxLength_dt">
4220
4279
  <xsl:variable name="lengths">
4221
4280
  <xsl:for-each select="*[local-name()='dt']">
@@ -4239,7 +4298,6 @@
4239
4298
  <xsl:value-of select="$maxLength"/>
4240
4299
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
4241
4300
  <xsl:param name="key_iso"/>
4242
-
4243
4301
  <!-- <tr>
4244
4302
  <td>NOTE</td>
4245
4303
  <td>
@@ -4247,18 +4305,30 @@
4247
4305
  </td>
4248
4306
  </tr>
4249
4307
  -->
4250
- <fo:table-row>
4308
+ <!-- OLD Variant -->
4309
+ <!-- <fo:table-row>
4251
4310
  <fo:table-cell>
4252
4311
  <fo:block margin-top="6pt">
4253
4312
  <xsl:if test="normalize-space($key_iso) = 'true'">
4254
4313
  <xsl:attribute name="margin-top">0</xsl:attribute>
4255
4314
  </xsl:if>
4256
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4315
+ <xsl:apply-templates select="*[local-name() = 'name']" />
4257
4316
  </fo:block>
4258
4317
  </fo:table-cell>
4259
4318
  <fo:table-cell>
4260
4319
  <fo:block>
4261
- <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"/>
4262
4332
  </fo:block>
4263
4333
  </fo:table-cell>
4264
4334
  </fo:table-row>
@@ -4360,13 +4430,15 @@
4360
4430
  <xsl:choose>
4361
4431
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4362
4432
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4363
- <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>
4364
4434
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4365
4435
  </xsl:choose>
4366
4436
  </xsl:attribute>
4367
4437
  </xsl:if>
4368
4438
  <xsl:apply-templates/>
4369
4439
  </fo:inline>
4440
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
4441
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4370
4442
  </xsl:template><xsl:template match="*[local-name()='underline']">
4371
4443
  <fo:inline text-decoration="underline">
4372
4444
  <xsl:apply-templates/>
@@ -4514,41 +4586,50 @@
4514
4586
  <fo:block break-after="page"/>
4515
4587
  <fo:block> </fo:block>
4516
4588
  <fo:block break-after="page"/>
4589
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
4590
+ <xsl:apply-templates/>
4517
4591
  </xsl:template><xsl:template name="tokenize">
4518
4592
  <xsl:param name="text"/>
4519
4593
  <xsl:param name="separator" select="' '"/>
4520
4594
  <xsl:choose>
4521
4595
  <xsl:when test="not(contains($text, $separator))">
4522
4596
  <word>
4523
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
4524
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
4525
4597
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
4526
- <xsl:variable name="len_str">
4527
- <xsl:choose>
4528
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
4529
- <xsl:value-of select="$len_str_tmp * 1.5"/>
4530
- </xsl:when>
4531
- <xsl:otherwise>
4532
- <xsl:value-of select="$len_str_tmp"/>
4533
- </xsl:otherwise>
4534
- </xsl:choose>
4535
- </xsl:variable>
4536
-
4537
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
4538
- <xsl:message>
4539
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
4540
- len_str=<xsl:value-of select="$len_str"/>
4541
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
4542
- </xsl:message>
4543
- </xsl:if> -->
4544
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
4545
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
4546
4598
  <xsl:choose>
4547
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
4548
- <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"/>
4549
4601
  </xsl:when>
4550
4602
  <xsl:otherwise>
4551
- <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>
4552
4633
  </xsl:otherwise>
4553
4634
  </xsl:choose>
4554
4635
  </word>
@@ -4634,24 +4715,28 @@
4634
4715
  </xsl:template><xsl:template name="add-zero-spaces-equal">
4635
4716
  <xsl:param name="text" select="."/>
4636
4717
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4718
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
4637
4719
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4720
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
4638
4721
  <xsl:variable name="zero-space">​</xsl:variable>
4639
4722
  <xsl:choose>
4640
4723
  <xsl:when test="contains($text, $zero-space-after-equals)">
4641
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4724
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4642
4725
  <xsl:value-of select="$zero-space-after-equals"/>
4643
4726
  <xsl:value-of select="$zero-space"/>
4644
4727
  <xsl:call-template name="add-zero-spaces-equal">
4645
4728
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
4646
- </xsl:call-template>
4729
+ </xsl:call-template> -->
4730
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
4647
4731
  </xsl:when>
4648
4732
  <xsl:when test="contains($text, $zero-space-after-equal)">
4649
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4733
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4650
4734
  <xsl:value-of select="$zero-space-after-equal"/>
4651
4735
  <xsl:value-of select="$zero-space"/>
4652
4736
  <xsl:call-template name="add-zero-spaces-equal">
4653
4737
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
4654
- </xsl:call-template>
4738
+ </xsl:call-template> -->
4739
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
4655
4740
  </xsl:when>
4656
4741
  <xsl:otherwise>
4657
4742
  <xsl:value-of select="$text"/>
@@ -4819,6 +4904,9 @@
4819
4904
  <xsl:variable name="isDeleted" select="@deleted"/>
4820
4905
 
4821
4906
  <fo:inline xsl:use-attribute-sets="mathml-style">
4907
+
4908
+
4909
+
4822
4910
 
4823
4911
 
4824
4912
  <xsl:call-template name="setTrackChangesStyles">
@@ -4826,48 +4914,80 @@
4826
4914
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4827
4915
  </xsl:call-template>
4828
4916
 
4917
+ <xsl:if test="$add_math_as_text = 'true'">
4918
+ <!-- insert helper tag -->
4919
+ <!-- set unique font-size (fiction) -->
4920
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4921
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
4922
+ </xsl:if>
4829
4923
 
4830
-
4831
- <xsl:variable name="mathml">
4832
- <xsl:apply-templates select="." mode="mathml"/>
4924
+ <xsl:variable name="mathml_content">
4925
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4833
4926
  </xsl:variable>
4834
- <fo:instream-foreign-object fox:alt-text="Math">
4835
4927
 
4928
+
4929
+ <xsl:call-template name="mathml_instream_object">
4930
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4931
+ </xsl:call-template>
4836
4932
 
4837
-
4838
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4839
- <xsl:variable name="comment_text_">
4840
- <xsl:choose>
4841
- <xsl:when test="normalize-space($comment_text_following) != ''">
4842
- <xsl:value-of select="$comment_text_following"/>
4843
- </xsl:when>
4844
- <xsl:otherwise>
4845
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4846
- </xsl:otherwise>
4847
- </xsl:choose>
4848
- </xsl:variable>
4849
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4850
-
4851
- <xsl:if test="normalize-space($comment_text) != ''">
4852
- <!-- put Mathin Alternate Text -->
4853
- <xsl:attribute name="fox:alt-text">
4854
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4855
- </xsl:attribute>
4856
- </xsl:if>
4857
-
4858
- <xsl:variable name="mathml_content">
4859
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4860
- </xsl:variable>
4861
- <!-- put MathML in Actual Text -->
4862
- <xsl:attribute name="fox:actual-text">
4863
- <xsl:value-of select="$mathml_content"/>
4864
- </xsl:attribute>
4865
-
4866
-
4867
-
4868
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4869
- </fo:instream-foreign-object>
4933
+
4870
4934
  </fo:inline>
4935
+ </xsl:template><xsl:template name="getMathml_comment_text">
4936
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4937
+ <xsl:variable name="comment_text_">
4938
+ <xsl:choose>
4939
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4940
+ <xsl:value-of select="$comment_text_following"/>
4941
+ </xsl:when>
4942
+ <xsl:otherwise>
4943
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4944
+ </xsl:otherwise>
4945
+ </xsl:choose>
4946
+ </xsl:variable>
4947
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4948
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4949
+ <xsl:value-of select="$comment_text"/>
4950
+ </xsl:template><xsl:template name="mathml_instream_object">
4951
+ <xsl:param name="comment_text"/>
4952
+ <xsl:param name="mathml_content"/>
4953
+
4954
+ <xsl:variable name="comment_text_">
4955
+ <xsl:choose>
4956
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4957
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4958
+ </xsl:choose>
4959
+ </xsl:variable>
4960
+
4961
+ <xsl:variable name="mathml">
4962
+ <xsl:apply-templates select="." mode="mathml"/>
4963
+ </xsl:variable>
4964
+
4965
+ <fo:instream-foreign-object fox:alt-text="Math">
4966
+
4967
+
4968
+
4969
+
4970
+
4971
+
4972
+
4973
+ <!-- put MathML in Actual Text -->
4974
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4975
+ <xsl:attribute name="fox:actual-text">
4976
+ <xsl:value-of select="$mathml_content"/>
4977
+ </xsl:attribute>
4978
+
4979
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4980
+ <xsl:if test="normalize-space($comment_text_) != ''">
4981
+ <!-- put Mathin Alternate Text -->
4982
+ <xsl:attribute name="fox:alt-text">
4983
+ <xsl:value-of select="$comment_text_"/>
4984
+ </xsl:attribute>
4985
+ </xsl:if>
4986
+ <!-- </xsl:if> -->
4987
+
4988
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4989
+
4990
+ </fo:instream-foreign-object>
4871
4991
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4872
4992
  <!-- <xsl:text>a+b</xsl:text> -->
4873
4993
  <xsl:text>&lt;</xsl:text>
@@ -4898,7 +5018,9 @@
4898
5018
  <!-- replace start and end spaces to non-break space -->
4899
5019
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4900
5020
  </xsl:copy>
4901
- </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">
4902
5024
  <xsl:variable name="target">
4903
5025
  <xsl:choose>
4904
5026
  <xsl:when test="@updatetype = 'true'">
@@ -5131,7 +5253,12 @@
5131
5253
 
5132
5254
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5133
5255
 
5256
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5257
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5258
+ </xsl:if>
5259
+
5134
5260
 
5261
+
5135
5262
 
5136
5263
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5137
5264
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5494,18 +5621,33 @@
5494
5621
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5495
5622
  <xsl:copy>
5496
5623
  <xsl:apply-templates select="@*" mode="svg_update"/>
5497
- <xsl:variable name="viewbox">
5624
+ <xsl:variable name="viewbox_">
5498
5625
  <xsl:call-template name="split">
5499
5626
  <xsl:with-param name="pText" select="@viewBox"/>
5500
5627
  <xsl:with-param name="sep" select="' '"/>
5501
5628
  </xsl:call-template>
5502
5629
  </xsl:variable>
5630
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5631
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5632
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5633
+
5503
5634
  <xsl:attribute name="width">
5504
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5635
+ <xsl:choose>
5636
+ <xsl:when test="$width != ''">
5637
+ <xsl:value-of select="round($width)"/>
5638
+ </xsl:when>
5639
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5640
+ </xsl:choose>
5505
5641
  </xsl:attribute>
5506
5642
  <xsl:attribute name="height">
5507
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5643
+ <xsl:choose>
5644
+ <xsl:when test="$height != ''">
5645
+ <xsl:value-of select="round($height)"/>
5646
+ </xsl:when>
5647
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5648
+ </xsl:choose>
5508
5649
  </xsl:attribute>
5650
+
5509
5651
  <xsl:apply-templates mode="svg_update"/>
5510
5652
  </xsl:copy>
5511
5653
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -5700,7 +5842,11 @@
5700
5842
  <xsl:apply-templates mode="bookmarks"/>
5701
5843
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5702
5844
  <xsl:apply-templates select="."/>
5703
- </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">
5704
5850
  <xsl:apply-templates mode="bookmarks"/>
5705
5851
  </xsl:template><xsl:template name="addBookmarks">
5706
5852
  <xsl:param name="contents"/>
@@ -5995,7 +6141,9 @@
5995
6141
  <xsl:apply-templates/>
5996
6142
  </xsl:otherwise>
5997
6143
  </xsl:choose>
5998
- </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">
5999
6147
  <xsl:text> </xsl:text>
6000
6148
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
6001
6149
  <xsl:copy>
@@ -6026,9 +6174,22 @@
6026
6174
  </xsl:when>
6027
6175
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
6028
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"/>
6029
6181
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6030
6182
 
6031
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
+
6032
6193
  <xsl:copy-of select="@id"/>
6033
6194
 
6034
6195
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -6140,17 +6301,15 @@
6140
6301
 
6141
6302
  <!-- split text by zero-width space -->
6142
6303
  <xsl:variable name="text_step4">
6143
- <xsl:call-template name="split">
6304
+ <xsl:call-template name="split_for_interspers">
6144
6305
  <xsl:with-param name="pText" select="$text_step3"/>
6145
6306
  <xsl:with-param name="sep" select="$zero_width_space"/>
6146
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6147
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6148
6307
  </xsl:call-template>
6149
6308
  </xsl:variable>
6150
6309
 
6151
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6310
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6152
6311
  <xsl:choose>
6153
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6312
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6154
6313
  <xsl:call-template name="interspers">
6155
6314
  <xsl:with-param name="str" select="."/>
6156
6315
  </xsl:call-template>
@@ -6161,6 +6320,30 @@
6161
6320
  </xsl:choose>
6162
6321
  </xsl:for-each>
6163
6322
 
6323
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
6324
+ <xsl:param name="pText" select="."/>
6325
+ <xsl:param name="sep" select="','"/>
6326
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6327
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6328
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6329
+ <xsl:call-template name="replace_tag_interspers">
6330
+ <xsl:with-param name="text" select="$text"/>
6331
+ </xsl:call-template>
6332
+ </xsl:template><xsl:template name="replace_tag_interspers">
6333
+ <xsl:param name="text"/>
6334
+ <xsl:choose>
6335
+ <xsl:when test="contains($text, $interspers_tag_open)">
6336
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6337
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6338
+ <interspers>
6339
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6340
+ </interspers>
6341
+ <xsl:call-template name="replace_tag_interspers">
6342
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6343
+ </xsl:call-template>
6344
+ </xsl:when>
6345
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6346
+ </xsl:choose>
6164
6347
  </xsl:template><xsl:template name="interspers">
6165
6348
  <xsl:param name="str"/>
6166
6349
  <xsl:param name="char" select="$zero_width_space"/>
@@ -6506,39 +6689,67 @@
6506
6689
  </xsl:otherwise>
6507
6690
  </xsl:choose>
6508
6691
  </xsl:template><xsl:template match="*[local-name() = 'example']">
6509
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6510
-
6692
+
6693
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
6694
+
6511
6695
 
6696
+
6512
6697
  <xsl:variable name="fo_element">
6513
- <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>
6514
6699
  inline
6515
6700
  </xsl:variable>
6516
6701
 
6517
- <!-- display 'EXAMPLE' -->
6518
- <xsl:apply-templates select="*[local-name()='name']">
6519
- <xsl:with-param name="fo_element" select="$fo_element"/>
6520
- </xsl:apply-templates>
6702
+ <fo:block-container margin-left="0mm">
6521
6703
 
6522
- <xsl:choose>
6523
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
6524
- <fo:block-container xsl:use-attribute-sets="example-body-style">
6525
- <fo:block-container margin-left="0mm" margin-right="0mm">
6526
- <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']">
6527
6711
  <xsl:with-param name="fo_element" select="$fo_element"/>
6528
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>
6529
6721
  </fo:block-container>
6530
- </fo:block-container>
6531
- </xsl:when>
6532
- <xsl:otherwise>
6533
- <fo:inline>
6534
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6535
- <xsl:with-param name="fo_element" select="$fo_element"/>
6536
- </xsl:apply-templates>
6537
- </fo:inline>
6538
- </xsl:otherwise>
6539
- </xsl:choose>
6540
-
6541
- </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>
6542
6753
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6543
6754
  <xsl:param name="fo_element">block</xsl:param>
6544
6755
 
@@ -6570,10 +6781,16 @@
6570
6781
  </xsl:variable>
6571
6782
  <xsl:choose>
6572
6783
  <xsl:when test="starts-with(normalize-space($element), 'block')">
6573
- <fo:block xsl:use-attribute-sets="example-p-style">
6574
-
6575
- <xsl:apply-templates/>
6576
- </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>
6577
6794
  </xsl:when>
6578
6795
  <xsl:otherwise>
6579
6796
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -6618,7 +6835,7 @@
6618
6835
  </xsl:otherwise>
6619
6836
  </xsl:choose> -->
6620
6837
  </fo:block>
6621
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6838
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
6622
6839
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6623
6840
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6624
6841
  <xsl:if test="normalize-space() != ''">
@@ -6752,7 +6969,16 @@
6752
6969
  </fo:inline>
6753
6970
  </xsl:when>
6754
6971
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6755
- <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
+
6756
6982
  </xsl:otherwise>
6757
6983
  </xsl:choose>
6758
6984
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6928,10 +7154,24 @@
6928
7154
 
6929
7155
  </fo:block>
6930
7156
  <xsl:apply-templates/>
6931
- </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 -->
6932
7158
  <!-- comment 2019-11-29 -->
6933
7159
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6934
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
+
6935
7175
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6936
7176
  <!-- 0xA0 to space replacement -->
6937
7177
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -7296,7 +7536,10 @@
7296
7536
  <!-- to split by '_' and other chars -->
7297
7537
  <xsl:call-template name="add-zero-spaces-java"/>
7298
7538
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7299
- <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>
7300
7543
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7301
7544
  <!-- <row>
7302
7545
  <date>05-07-2013</date>
@@ -7963,6 +8206,120 @@
7963
8206
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7964
8207
  </xsl:for-each>
7965
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>
7966
8323
  </xsl:template><xsl:template name="convertDate">
7967
8324
  <xsl:param name="date"/>
7968
8325
  <xsl:param name="format" select="'short'"/>