metanorma-un 0.8.6 → 0.9.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.
@@ -32,7 +32,13 @@
32
32
 
33
33
  <xsl:template match="/">
34
34
  <xsl:call-template name="namespaceCheck"/>
35
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
35
+ <fo:root xml:lang="{$lang}">
36
+ <xsl:variable name="root-style">
37
+ <root-style xsl:use-attribute-sets="root-style"/>
38
+ </xsl:variable>
39
+ <xsl:call-template name="insertRootStyle">
40
+ <xsl:with-param name="root-style" select="$root-style"/>
41
+ </xsl:call-template>
36
42
  <fo:layout-master-set>
37
43
  <!-- Cover page -->
38
44
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -827,7 +833,7 @@
827
833
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8i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Xbaow58novC6+zflRu92+I11BBQVFGs2TOrduuXKHbacDX+b65RuM+GowTjUAPQam8XjA6SNE23chcKnAvm/Fd/q/b+pCZF+Sl+P7vKGxdZ0/P/8TWFodKJUxzk/ABIcq6S4AN1w2JO8n5WfQ24WU8ynKdVem8l80QzUwx2y0exd1OefiZp2SwkH7fIApxnIhHgN/uwSnK9rHMGlTzW27fbttd6WZ4vyOjg6GU1zf67RY5eXlZTt37mz3PliWCaHL5ubmlm7QhsvK9sMi/W48Holu2rQxfTIvEVlcrPTjqe4EZ7CgwBdra9uSmtcPt6eta6FynHEJKYGv2Jd90s86AQpAwNJsRuT5xUAHrKK4IkCd9g6NQAQPIi8vz4f5o72tANZVgO/GMpe59RvrtQvt7JMQLS0dAyI9sst1m7uTuL28gqwJBqfh8pTaWOTqTIvSblYxVtTe2RnbvHlzg/fsEofcLK4oasda9edCs9An49viDe3tm3sS2YHA/gAL39Le/tU2lGFS0mphWYsBlhI432690j5UQnnB0DjXjuv/Pkr/knwu5fQOx46PR+RzPKz5FG+vOtVFmJn08mQq/ix17K4bM722kS3f8O0J0IOnwddK6jo7zqrx5f7EdckzAOrK/5erFeIorlh4YH/pthHXfac7449A8DVAaRXYTgUQ4wdj/xgw8ytFk7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO8nXeWcqW3QOHeLyryF/Q4L3BoEhzW+fOO0A12vewbTZxj6/yWeCqz4J31WY1ny3/F6UYkeY68LIzhtsxa8myZailU1K6HlxN/x9kjcPp+HcBBgAS2JZd+kqHSQAAAABJRU5ErkJggg==</xsl:text>
828
834
  </xsl:variable>
829
835
 
830
- <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">
836
+ <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">
831
837
  <xsl:call-template name="getLang"/>
832
838
  </xsl:variable><xsl:variable name="pageWidth_">
833
839
  210
@@ -842,20 +848,7 @@
842
848
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
843
849
  40
844
850
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
845
-
846
- <title-edition lang="en">
847
-
848
- <xsl:text>Edition </xsl:text>
849
-
850
- </title-edition>
851
851
 
852
- <title-edition lang="fr">
853
- <xsl:text>Édition </xsl:text>
854
- </title-edition>
855
-
856
- <title-edition lang="ru">
857
- <xsl:text>Издание </xsl:text>
858
- </title-edition>
859
852
 
860
853
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
861
854
  <title-toc lang="en">
@@ -934,7 +927,7 @@
934
927
  </xsl:variable><xsl:variable name="bibdata">
935
928
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
936
929
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
937
- </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">
930
+ </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">
938
931
  <xsl:param name="name"/>
939
932
  <xsl:param name="lang"/>
940
933
  <xsl:variable name="lang_">
@@ -977,7 +970,30 @@
977
970
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
978
971
  <xsl:attribute name="font-size">10pt</xsl:attribute>
979
972
 
980
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
973
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
974
+ <xsl:param name="root-style"/>
975
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
976
+
977
+ <xsl:variable name="additional_fonts_">
978
+ <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']">
979
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
980
+ </xsl:for-each>
981
+ </xsl:variable>
982
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
983
+
984
+ <xsl:for-each select="$root-style_/root-style/@*">
985
+ <xsl:choose>
986
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
987
+ <xsl:attribute name="{local-name()}">
988
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
989
+ </xsl:attribute>
990
+ </xsl:when>
991
+ <xsl:otherwise>
992
+ <xsl:copy-of select="."/>
993
+ </xsl:otherwise>
994
+ </xsl:choose>
995
+ </xsl:for-each>
996
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
981
997
 
982
998
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
983
999
 
@@ -1031,7 +1047,6 @@
1031
1047
 
1032
1048
 
1033
1049
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
1034
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1035
1050
 
1036
1051
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1037
1052
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1111,6 +1126,7 @@
1111
1126
 
1112
1127
 
1113
1128
 
1129
+
1114
1130
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1115
1131
 
1116
1132
 
@@ -1493,7 +1509,7 @@
1493
1509
 
1494
1510
 
1495
1511
 
1496
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1512
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1497
1513
 
1498
1514
 
1499
1515
 
@@ -2188,10 +2204,41 @@
2188
2204
  <xsl:sort select="@displayorder" data-type="number"/>
2189
2205
  <xsl:apply-templates select="."/>
2190
2206
  </xsl:for-each>
2191
- </xsl:template><xsl:template match="text()">
2192
- <xsl:value-of select="."/>
2207
+ </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">
2208
+
2209
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2210
+ <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))"/>
2211
+ <xsl:call-template name="replace_fo_inline_tags">
2212
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2213
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2214
+ <xsl:with-param name="text" select="$text"/>
2215
+ </xsl:call-template>
2216
+
2217
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
2218
+ <xsl:param name="tag_open"/>
2219
+ <xsl:param name="tag_close"/>
2220
+ <xsl:param name="text"/>
2221
+ <xsl:choose>
2222
+ <xsl:when test="contains($text, $tag_open)">
2223
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
2224
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2225
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2226
+ <fo:inline keep-together.within-line="always">
2227
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2228
+ </fo:inline>
2229
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2230
+ <xsl:call-template name="replace_fo_inline_tags">
2231
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2232
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2233
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2234
+ </xsl:call-template>
2235
+ </xsl:when>
2236
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
2237
+ </xsl:choose>
2193
2238
  </xsl:template><xsl:template match="*[local-name()='br']">
2194
2239
  <xsl:value-of select="$linebreak"/>
2240
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
2241
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
2195
2242
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2196
2243
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2197
2244
  <xsl:apply-templates/>
@@ -2257,8 +2304,23 @@
2257
2304
  </xsl:call-template>
2258
2305
 
2259
2306
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2260
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2261
- <xsl:call-template name="add-zero-spaces-java"/>
2307
+ <xsl:choose>
2308
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2309
+ <xsl:value-of select="."/>
2310
+ </xsl:when>
2311
+ <xsl:otherwise>
2312
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2313
+ </xsl:otherwise>
2314
+ </xsl:choose>
2315
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2316
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2317
+ <!-- <xsl:copy-of select="$text"/> -->
2318
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2319
+ <xsl:choose>
2320
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2321
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2322
+ </xsl:choose>
2323
+ </xsl:for-each>
2262
2324
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2263
2325
 
2264
2326
  <xsl:variable name="table-preamble">
@@ -2387,16 +2449,9 @@
2387
2449
  </xsl:for-each>
2388
2450
  </xsl:when>
2389
2451
  <xsl:otherwise>
2390
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2391
- <xsl:choose>
2392
- <xsl:when test=". = 1 or . = 0">
2393
- <fo:table-column column-width="proportional-column-width(2)"/>
2394
- </xsl:when>
2395
- <xsl:otherwise>
2396
- <fo:table-column column-width="proportional-column-width({.})"/>
2397
- </xsl:otherwise>
2398
- </xsl:choose>
2399
- </xsl:for-each>
2452
+ <xsl:call-template name="insertTableColumnWidth">
2453
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2454
+ </xsl:call-template>
2400
2455
  </xsl:otherwise>
2401
2456
  </xsl:choose>
2402
2457
 
@@ -2557,6 +2612,7 @@
2557
2612
  <xsl:with-param name="text" select="$td_text"/>
2558
2613
  </xsl:call-template>
2559
2614
  </xsl:variable>
2615
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2560
2616
  <xsl:call-template name="tokenize">
2561
2617
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2562
2618
  <!-- 2009 thinspace -->
@@ -2569,6 +2625,7 @@
2569
2625
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2570
2626
  </xsl:call-template>
2571
2627
  </xsl:variable>
2628
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2572
2629
  <width>
2573
2630
  <xsl:variable name="divider">
2574
2631
  <xsl:choose>
@@ -2601,6 +2658,10 @@
2601
2658
  <xsl:with-param name="table" select="$table"/>
2602
2659
  </xsl:call-template>
2603
2660
  </xsl:if>
2661
+ </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2662
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2663
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2664
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2604
2665
  </xsl:template><xsl:template match="text()" mode="td_text">
2605
2666
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2606
2667
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -2702,16 +2763,9 @@
2702
2763
  </xsl:for-each>
2703
2764
  </xsl:when>
2704
2765
  <xsl:otherwise>
2705
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2706
- <xsl:choose>
2707
- <xsl:when test=". = 1 or . = 0">
2708
- <fo:table-column column-width="proportional-column-width(2)"/>
2709
- </xsl:when>
2710
- <xsl:otherwise>
2711
- <fo:table-column column-width="proportional-column-width({.})"/>
2712
- </xsl:otherwise>
2713
- </xsl:choose>
2714
- </xsl:for-each>
2766
+ <xsl:call-template name="insertTableColumnWidth">
2767
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2768
+ </xsl:call-template>
2715
2769
  </xsl:otherwise>
2716
2770
  </xsl:choose>
2717
2771
 
@@ -3260,8 +3314,10 @@
3260
3314
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3261
3315
  </xsl:variable>
3262
3316
 
3317
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3318
+
3263
3319
  <xsl:choose>
3264
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3320
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3265
3321
 
3266
3322
  <fo:block margin-bottom="12pt" text-align="left">
3267
3323
 
@@ -3276,7 +3332,7 @@
3276
3332
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3277
3333
  </fo:block>
3278
3334
 
3279
- </xsl:when>
3335
+ </xsl:when> <!-- END: only one component -->
3280
3336
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3281
3337
  <fo:block margin-bottom="12pt" text-align="left">
3282
3338
 
@@ -3290,8 +3346,8 @@
3290
3346
  </xsl:variable>
3291
3347
  <xsl:value-of select="$title-where"/>
3292
3348
  </fo:block>
3293
- </xsl:when>
3294
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3349
+ </xsl:when> <!-- END: a few components -->
3350
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3295
3351
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3296
3352
 
3297
3353
 
@@ -3304,11 +3360,11 @@
3304
3360
  </xsl:variable>
3305
3361
  <xsl:value-of select="$title-key"/>
3306
3362
  </fo:block>
3307
- </xsl:when>
3363
+ </xsl:when> <!-- END: definition list in a figure -->
3308
3364
  </xsl:choose>
3309
3365
 
3310
3366
  <!-- a few components -->
3311
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3367
+ <xsl:if test="$onlyOneComponent = 'false'">
3312
3368
  <fo:block>
3313
3369
 
3314
3370
 
@@ -3347,21 +3403,28 @@
3347
3403
  <xsl:apply-templates mode="dl"/>
3348
3404
  </tbody>
3349
3405
  </xsl:variable>
3350
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3406
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3351
3407
  <xsl:variable name="colwidths">
3352
3408
  <xsl:call-template name="calculate-column-widths">
3353
3409
  <xsl:with-param name="cols-count" select="2"/>
3354
3410
  <xsl:with-param name="table" select="$html-table"/>
3355
3411
  </xsl:call-template>
3356
3412
  </xsl:variable>
3357
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3413
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3358
3414
  <xsl:variable name="maxlength_dt">
3359
3415
  <xsl:call-template name="getMaxLength_dt"/>
3360
3416
  </xsl:variable>
3417
+ <xsl:variable name="isContainsKeepTogetherTag_">
3418
+ false
3419
+ </xsl:variable>
3420
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3421
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3361
3422
  <xsl:call-template name="setColumnWidth_dl">
3362
3423
  <xsl:with-param name="colwidths" select="$colwidths"/>
3363
3424
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3425
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3364
3426
  </xsl:call-template>
3427
+
3365
3428
  <fo:table-body>
3366
3429
  <xsl:apply-templates>
3367
3430
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3370,12 +3433,13 @@
3370
3433
  </fo:table>
3371
3434
  </fo:block>
3372
3435
  </fo:block>
3373
- </xsl:if>
3436
+ </xsl:if> <!-- END: a few components -->
3374
3437
  </fo:block-container>
3375
3438
  </fo:block-container>
3376
3439
  </xsl:template><xsl:template name="setColumnWidth_dl">
3377
3440
  <xsl:param name="colwidths"/>
3378
3441
  <xsl:param name="maxlength_dt"/>
3442
+ <xsl:param name="isContainsKeepTogetherTag"/>
3379
3443
  <xsl:choose>
3380
3444
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3381
3445
  <fo:table-column column-width="50%"/>
@@ -3383,6 +3447,11 @@
3383
3447
  </xsl:when>
3384
3448
  <xsl:otherwise>
3385
3449
  <xsl:choose>
3450
+ <xsl:when test="$isContainsKeepTogetherTag">
3451
+ <xsl:call-template name="insertTableColumnWidth">
3452
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3453
+ </xsl:call-template>
3454
+ </xsl:when>
3386
3455
  <!-- to set width check most wide chars like `W` -->
3387
3456
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3388
3457
  <fo:table-column column-width="7%"/>
@@ -3413,20 +3482,25 @@
3413
3482
  <fo:table-column column-width="60%"/>
3414
3483
  </xsl:when>
3415
3484
  <xsl:otherwise>
3416
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3417
- <xsl:choose>
3418
- <xsl:when test=". = 1 or . = 0">
3419
- <fo:table-column column-width="proportional-column-width(2)"/>
3420
- </xsl:when>
3421
- <xsl:otherwise>
3422
- <fo:table-column column-width="proportional-column-width({.})"/>
3423
- </xsl:otherwise>
3424
- </xsl:choose>
3425
- </xsl:for-each>
3485
+ <xsl:call-template name="insertTableColumnWidth">
3486
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3487
+ </xsl:call-template>
3426
3488
  </xsl:otherwise>
3427
3489
  </xsl:choose>
3428
3490
  </xsl:otherwise>
3429
3491
  </xsl:choose>
3492
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3493
+ <xsl:param name="colwidths"/>
3494
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3495
+ <xsl:choose>
3496
+ <xsl:when test=". = 1 or . = 0">
3497
+ <fo:table-column column-width="proportional-column-width(2)"/>
3498
+ </xsl:when>
3499
+ <xsl:otherwise>
3500
+ <fo:table-column column-width="proportional-column-width({.})"/>
3501
+ </xsl:otherwise>
3502
+ </xsl:choose>
3503
+ </xsl:for-each>
3430
3504
  </xsl:template><xsl:template name="getMaxLength_dt">
3431
3505
  <xsl:variable name="lengths">
3432
3506
  <xsl:for-each select="*[local-name()='dt']">
@@ -3450,7 +3524,6 @@
3450
3524
  <xsl:value-of select="$maxLength"/>
3451
3525
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3452
3526
  <xsl:param name="key_iso"/>
3453
-
3454
3527
  <!-- <tr>
3455
3528
  <td>NOTE</td>
3456
3529
  <td>
@@ -3458,18 +3531,30 @@
3458
3531
  </td>
3459
3532
  </tr>
3460
3533
  -->
3461
- <fo:table-row>
3534
+ <!-- OLD Variant -->
3535
+ <!-- <fo:table-row>
3462
3536
  <fo:table-cell>
3463
3537
  <fo:block margin-top="6pt">
3464
3538
  <xsl:if test="normalize-space($key_iso) = 'true'">
3465
3539
  <xsl:attribute name="margin-top">0</xsl:attribute>
3466
3540
  </xsl:if>
3467
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3541
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3468
3542
  </fo:block>
3469
3543
  </fo:table-cell>
3470
3544
  <fo:table-cell>
3471
3545
  <fo:block>
3472
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3546
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3547
+ </fo:block>
3548
+ </fo:table-cell>
3549
+ </fo:table-row> -->
3550
+ <!-- <tr>
3551
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3552
+ </tr>
3553
+ -->
3554
+ <fo:table-row>
3555
+ <fo:table-cell number-columns-spanned="2">
3556
+ <fo:block>
3557
+ <xsl:call-template name="note"/>
3473
3558
  </fo:block>
3474
3559
  </fo:table-cell>
3475
3560
  </fo:table-row>
@@ -3571,13 +3656,15 @@
3571
3656
  <xsl:choose>
3572
3657
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3573
3658
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3574
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3659
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3575
3660
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3576
3661
  </xsl:choose>
3577
3662
  </xsl:attribute>
3578
3663
  </xsl:if>
3579
3664
  <xsl:apply-templates/>
3580
3665
  </fo:inline>
3666
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
3667
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3581
3668
  </xsl:template><xsl:template match="*[local-name()='underline']">
3582
3669
  <fo:inline text-decoration="underline">
3583
3670
  <xsl:apply-templates/>
@@ -3725,41 +3812,50 @@
3725
3812
  <fo:block break-after="page"/>
3726
3813
  <fo:block> </fo:block>
3727
3814
  <fo:block break-after="page"/>
3815
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
3816
+ <xsl:apply-templates/>
3728
3817
  </xsl:template><xsl:template name="tokenize">
3729
3818
  <xsl:param name="text"/>
3730
3819
  <xsl:param name="separator" select="' '"/>
3731
3820
  <xsl:choose>
3732
3821
  <xsl:when test="not(contains($text, $separator))">
3733
3822
  <word>
3734
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3735
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3736
3823
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3737
- <xsl:variable name="len_str">
3738
- <xsl:choose>
3739
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3740
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3741
- </xsl:when>
3742
- <xsl:otherwise>
3743
- <xsl:value-of select="$len_str_tmp"/>
3744
- </xsl:otherwise>
3745
- </xsl:choose>
3746
- </xsl:variable>
3747
-
3748
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3749
- <xsl:message>
3750
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3751
- len_str=<xsl:value-of select="$len_str"/>
3752
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3753
- </xsl:message>
3754
- </xsl:if> -->
3755
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3756
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3757
3824
  <xsl:choose>
3758
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3759
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3825
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
3826
+ <xsl:value-of select="$len_str_tmp"/>
3760
3827
  </xsl:when>
3761
3828
  <xsl:otherwise>
3762
- <xsl:value-of select="$len_str"/>
3829
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3830
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3831
+ <xsl:variable name="len_str">
3832
+ <xsl:choose>
3833
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3834
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
3835
+ </xsl:when>
3836
+ <xsl:otherwise>
3837
+ <xsl:value-of select="$len_str_tmp"/>
3838
+ </xsl:otherwise>
3839
+ </xsl:choose>
3840
+ </xsl:variable>
3841
+
3842
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3843
+ <xsl:message>
3844
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3845
+ len_str=<xsl:value-of select="$len_str"/>
3846
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3847
+ </xsl:message>
3848
+ </xsl:if> -->
3849
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3850
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
3851
+ <xsl:choose>
3852
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3853
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3854
+ </xsl:when>
3855
+ <xsl:otherwise>
3856
+ <xsl:value-of select="$len_str"/>
3857
+ </xsl:otherwise>
3858
+ </xsl:choose>
3763
3859
  </xsl:otherwise>
3764
3860
  </xsl:choose>
3765
3861
  </word>
@@ -3845,24 +3941,28 @@
3845
3941
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3846
3942
  <xsl:param name="text" select="."/>
3847
3943
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3944
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3848
3945
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3946
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3849
3947
  <xsl:variable name="zero-space">​</xsl:variable>
3850
3948
  <xsl:choose>
3851
3949
  <xsl:when test="contains($text, $zero-space-after-equals)">
3852
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3950
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3853
3951
  <xsl:value-of select="$zero-space-after-equals"/>
3854
3952
  <xsl:value-of select="$zero-space"/>
3855
3953
  <xsl:call-template name="add-zero-spaces-equal">
3856
3954
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3857
- </xsl:call-template>
3955
+ </xsl:call-template> -->
3956
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3858
3957
  </xsl:when>
3859
3958
  <xsl:when test="contains($text, $zero-space-after-equal)">
3860
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3959
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3861
3960
  <xsl:value-of select="$zero-space-after-equal"/>
3862
3961
  <xsl:value-of select="$zero-space"/>
3863
3962
  <xsl:call-template name="add-zero-spaces-equal">
3864
3963
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3865
- </xsl:call-template>
3964
+ </xsl:call-template> -->
3965
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3866
3966
  </xsl:when>
3867
3967
  <xsl:otherwise>
3868
3968
  <xsl:value-of select="$text"/>
@@ -4030,6 +4130,9 @@
4030
4130
  <xsl:variable name="isDeleted" select="@deleted"/>
4031
4131
 
4032
4132
  <fo:inline xsl:use-attribute-sets="mathml-style">
4133
+
4134
+
4135
+
4033
4136
 
4034
4137
 
4035
4138
  <xsl:call-template name="setTrackChangesStyles">
@@ -4037,48 +4140,80 @@
4037
4140
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4038
4141
  </xsl:call-template>
4039
4142
 
4143
+ <xsl:if test="$add_math_as_text = 'true'">
4144
+ <!-- insert helper tag -->
4145
+ <!-- set unique font-size (fiction) -->
4146
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4147
+ <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 -->
4148
+ </xsl:if>
4040
4149
 
4041
-
4042
- <xsl:variable name="mathml">
4043
- <xsl:apply-templates select="." mode="mathml"/>
4150
+ <xsl:variable name="mathml_content">
4151
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4044
4152
  </xsl:variable>
4045
- <fo:instream-foreign-object fox:alt-text="Math">
4046
4153
 
4154
+
4155
+ <xsl:call-template name="mathml_instream_object">
4156
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4157
+ </xsl:call-template>
4047
4158
 
4048
-
4049
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4050
- <xsl:variable name="comment_text_">
4051
- <xsl:choose>
4052
- <xsl:when test="normalize-space($comment_text_following) != ''">
4053
- <xsl:value-of select="$comment_text_following"/>
4054
- </xsl:when>
4055
- <xsl:otherwise>
4056
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4057
- </xsl:otherwise>
4058
- </xsl:choose>
4059
- </xsl:variable>
4060
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4061
-
4062
- <xsl:if test="normalize-space($comment_text) != ''">
4063
- <!-- put Mathin Alternate Text -->
4064
- <xsl:attribute name="fox:alt-text">
4065
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4066
- </xsl:attribute>
4067
- </xsl:if>
4068
-
4069
- <xsl:variable name="mathml_content">
4070
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4071
- </xsl:variable>
4072
- <!-- put MathML in Actual Text -->
4073
- <xsl:attribute name="fox:actual-text">
4074
- <xsl:value-of select="$mathml_content"/>
4075
- </xsl:attribute>
4076
-
4077
-
4078
-
4079
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4080
- </fo:instream-foreign-object>
4159
+
4081
4160
  </fo:inline>
4161
+ </xsl:template><xsl:template name="getMathml_comment_text">
4162
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4163
+ <xsl:variable name="comment_text_">
4164
+ <xsl:choose>
4165
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4166
+ <xsl:value-of select="$comment_text_following"/>
4167
+ </xsl:when>
4168
+ <xsl:otherwise>
4169
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4170
+ </xsl:otherwise>
4171
+ </xsl:choose>
4172
+ </xsl:variable>
4173
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4174
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4175
+ <xsl:value-of select="$comment_text"/>
4176
+ </xsl:template><xsl:template name="mathml_instream_object">
4177
+ <xsl:param name="comment_text"/>
4178
+ <xsl:param name="mathml_content"/>
4179
+
4180
+ <xsl:variable name="comment_text_">
4181
+ <xsl:choose>
4182
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4183
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4184
+ </xsl:choose>
4185
+ </xsl:variable>
4186
+
4187
+ <xsl:variable name="mathml">
4188
+ <xsl:apply-templates select="." mode="mathml"/>
4189
+ </xsl:variable>
4190
+
4191
+ <fo:instream-foreign-object fox:alt-text="Math">
4192
+
4193
+
4194
+
4195
+
4196
+
4197
+
4198
+
4199
+ <!-- put MathML in Actual Text -->
4200
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4201
+ <xsl:attribute name="fox:actual-text">
4202
+ <xsl:value-of select="$mathml_content"/>
4203
+ </xsl:attribute>
4204
+
4205
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4206
+ <xsl:if test="normalize-space($comment_text_) != ''">
4207
+ <!-- put Mathin Alternate Text -->
4208
+ <xsl:attribute name="fox:alt-text">
4209
+ <xsl:value-of select="$comment_text_"/>
4210
+ </xsl:attribute>
4211
+ </xsl:if>
4212
+ <!-- </xsl:if> -->
4213
+
4214
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4215
+
4216
+ </fo:instream-foreign-object>
4082
4217
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4083
4218
  <!-- <xsl:text>a+b</xsl:text> -->
4084
4219
  <xsl:text>&lt;</xsl:text>
@@ -4109,7 +4244,9 @@
4109
4244
  <!-- replace start and end spaces to non-break space -->
4110
4245
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4111
4246
  </xsl:copy>
4112
- </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">
4247
+ </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">
4248
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
4249
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4113
4250
  <xsl:variable name="target">
4114
4251
  <xsl:choose>
4115
4252
  <xsl:when test="@updatetype = 'true'">
@@ -4352,7 +4489,12 @@
4352
4489
 
4353
4490
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4354
4491
 
4492
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4493
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4494
+ </xsl:if>
4495
+
4355
4496
 
4497
+
4356
4498
 
4357
4499
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4358
4500
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -4713,18 +4855,33 @@
4713
4855
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4714
4856
  <xsl:copy>
4715
4857
  <xsl:apply-templates select="@*" mode="svg_update"/>
4716
- <xsl:variable name="viewbox">
4858
+ <xsl:variable name="viewbox_">
4717
4859
  <xsl:call-template name="split">
4718
4860
  <xsl:with-param name="pText" select="@viewBox"/>
4719
4861
  <xsl:with-param name="sep" select="' '"/>
4720
4862
  </xsl:call-template>
4721
4863
  </xsl:variable>
4864
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
4865
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
4866
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
4867
+
4722
4868
  <xsl:attribute name="width">
4723
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4869
+ <xsl:choose>
4870
+ <xsl:when test="$width != ''">
4871
+ <xsl:value-of select="round($width)"/>
4872
+ </xsl:when>
4873
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
4874
+ </xsl:choose>
4724
4875
  </xsl:attribute>
4725
4876
  <xsl:attribute name="height">
4726
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4877
+ <xsl:choose>
4878
+ <xsl:when test="$height != ''">
4879
+ <xsl:value-of select="round($height)"/>
4880
+ </xsl:when>
4881
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
4882
+ </xsl:choose>
4727
4883
  </xsl:attribute>
4884
+
4728
4885
  <xsl:apply-templates mode="svg_update"/>
4729
4886
  </xsl:copy>
4730
4887
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4919,7 +5076,11 @@
4919
5076
  <xsl:apply-templates mode="bookmarks"/>
4920
5077
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4921
5078
  <xsl:apply-templates select="."/>
4922
- </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">
5079
+ </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">
5080
+ <xsl:apply-templates mode="contents"/>
5081
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5082
+ <xsl:apply-templates mode="bookmarks"/>
5083
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4923
5084
  <xsl:apply-templates mode="bookmarks"/>
4924
5085
  </xsl:template><xsl:template name="addBookmarks">
4925
5086
  <xsl:param name="contents"/>
@@ -5201,7 +5362,9 @@
5201
5362
  <xsl:apply-templates/>
5202
5363
  </xsl:otherwise>
5203
5364
  </xsl:choose>
5204
- </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">
5365
+ </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">
5366
+ <xsl:value-of select="."/>
5367
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
5205
5368
  <xsl:text> </xsl:text>
5206
5369
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5207
5370
  <xsl:copy>
@@ -5232,9 +5395,22 @@
5232
5395
  </xsl:when>
5233
5396
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5234
5397
  </xsl:choose>
5398
+ </xsl:template><xsl:template match="text()" mode="contents_item">
5399
+ <xsl:call-template name="keep_together_standard_number"/>
5400
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
5401
+ <xsl:apply-templates mode="contents_item"/>
5235
5402
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5236
5403
 
5237
5404
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
5405
+
5406
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
5407
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5408
+ </xsl:if>
5409
+
5410
+ <xsl:if test="ancestor::*[local-name() = 'example']">
5411
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5412
+ </xsl:if>
5413
+
5238
5414
  <xsl:copy-of select="@id"/>
5239
5415
 
5240
5416
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5334,17 +5510,15 @@
5334
5510
 
5335
5511
  <!-- split text by zero-width space -->
5336
5512
  <xsl:variable name="text_step4">
5337
- <xsl:call-template name="split">
5513
+ <xsl:call-template name="split_for_interspers">
5338
5514
  <xsl:with-param name="pText" select="$text_step3"/>
5339
5515
  <xsl:with-param name="sep" select="$zero_width_space"/>
5340
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5341
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5342
5516
  </xsl:call-template>
5343
5517
  </xsl:variable>
5344
5518
 
5345
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5519
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5346
5520
  <xsl:choose>
5347
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5521
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5348
5522
  <xsl:call-template name="interspers">
5349
5523
  <xsl:with-param name="str" select="."/>
5350
5524
  </xsl:call-template>
@@ -5355,6 +5529,30 @@
5355
5529
  </xsl:choose>
5356
5530
  </xsl:for-each>
5357
5531
 
5532
+ </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">
5533
+ <xsl:param name="pText" select="."/>
5534
+ <xsl:param name="sep" select="','"/>
5535
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5536
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5537
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5538
+ <xsl:call-template name="replace_tag_interspers">
5539
+ <xsl:with-param name="text" select="$text"/>
5540
+ </xsl:call-template>
5541
+ </xsl:template><xsl:template name="replace_tag_interspers">
5542
+ <xsl:param name="text"/>
5543
+ <xsl:choose>
5544
+ <xsl:when test="contains($text, $interspers_tag_open)">
5545
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5546
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5547
+ <interspers>
5548
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5549
+ </interspers>
5550
+ <xsl:call-template name="replace_tag_interspers">
5551
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5552
+ </xsl:call-template>
5553
+ </xsl:when>
5554
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5555
+ </xsl:choose>
5358
5556
  </xsl:template><xsl:template name="interspers">
5359
5557
  <xsl:param name="str"/>
5360
5558
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5690,39 +5888,67 @@
5690
5888
  </xsl:otherwise>
5691
5889
  </xsl:choose>
5692
5890
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5693
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5694
-
5891
+
5892
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
5893
+
5695
5894
 
5895
+
5696
5896
  <xsl:variable name="fo_element">
5697
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
5897
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5698
5898
  block
5699
5899
  </xsl:variable>
5700
5900
 
5701
- <!-- display 'EXAMPLE' -->
5702
- <xsl:apply-templates select="*[local-name()='name']">
5703
- <xsl:with-param name="fo_element" select="$fo_element"/>
5704
- </xsl:apply-templates>
5901
+ <fo:block-container margin-left="0mm">
5705
5902
 
5706
- <xsl:choose>
5707
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5708
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5709
- <fo:block-container margin-left="0mm" margin-right="0mm">
5710
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5903
+ <xsl:choose>
5904
+
5905
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5906
+
5907
+ <!-- display name 'EXAMPLE' in a separate block -->
5908
+ <fo:block>
5909
+ <xsl:apply-templates select="*[local-name()='name']">
5711
5910
  <xsl:with-param name="fo_element" select="$fo_element"/>
5712
5911
  </xsl:apply-templates>
5912
+ </fo:block>
5913
+
5914
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5915
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5916
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5917
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5918
+ </xsl:apply-templates>
5919
+ </fo:block-container>
5713
5920
  </fo:block-container>
5714
- </fo:block-container>
5715
- </xsl:when>
5716
- <xsl:otherwise>
5717
- <fo:inline>
5718
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5719
- <xsl:with-param name="fo_element" select="$fo_element"/>
5720
- </xsl:apply-templates>
5721
- </fo:inline>
5722
- </xsl:otherwise>
5723
- </xsl:choose>
5724
-
5725
- </fo:block>
5921
+ </xsl:when> <!-- end block -->
5922
+
5923
+ <xsl:otherwise> <!-- inline -->
5924
+
5925
+ <!-- display 'EXAMPLE' and first element in the same line -->
5926
+ <fo:block>
5927
+ <xsl:apply-templates select="*[local-name()='name']">
5928
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5929
+ </xsl:apply-templates>
5930
+ <fo:inline>
5931
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
5932
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5933
+ </xsl:apply-templates>
5934
+ </fo:inline>
5935
+ </fo:block>
5936
+
5937
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
5938
+ <!-- display further elements in blocks -->
5939
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5940
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5941
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
5942
+ <xsl:with-param name="fo_element" select="'block'"/>
5943
+ </xsl:apply-templates>
5944
+ </fo:block-container>
5945
+ </fo:block-container>
5946
+ </xsl:if>
5947
+ </xsl:otherwise> <!-- end inline -->
5948
+
5949
+ </xsl:choose>
5950
+ </fo:block-container>
5951
+ </fo:block-container>
5726
5952
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5727
5953
  <xsl:param name="fo_element">block</xsl:param>
5728
5954
 
@@ -5754,14 +5980,20 @@
5754
5980
  </xsl:variable>
5755
5981
  <xsl:choose>
5756
5982
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5757
- <fo:block xsl:use-attribute-sets="example-p-style">
5758
-
5759
- <xsl:if test="$num = 1">
5760
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
5761
- </xsl:if>
5762
-
5763
- <xsl:apply-templates/>
5764
- </fo:block>
5983
+ <fo:block-container>
5984
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
5985
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5986
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5987
+ </xsl:if>
5988
+ <fo:block xsl:use-attribute-sets="example-p-style">
5989
+
5990
+ <xsl:if test="$num = 1">
5991
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
5992
+ </xsl:if>
5993
+
5994
+ <xsl:apply-templates/>
5995
+ </fo:block>
5996
+ </fo:block-container>
5765
5997
  </xsl:when>
5766
5998
  <xsl:otherwise>
5767
5999
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5806,7 +6038,7 @@
5806
6038
  </xsl:otherwise>
5807
6039
  </xsl:choose> -->
5808
6040
  </fo:block>
5809
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6041
+ </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">
5810
6042
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5811
6043
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5812
6044
  <xsl:if test="normalize-space() != ''">
@@ -5842,7 +6074,8 @@
5842
6074
  <fo:inline><xsl:apply-templates/></fo:inline>
5843
6075
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
5844
6076
  <xsl:if test="normalize-space() != ''">
5845
- <xsl:value-of select="."/>
6077
+ <!-- <xsl:value-of select="."/> -->
6078
+ <xsl:call-template name="text"/>
5846
6079
  </xsl:if>
5847
6080
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
5848
6081
  <fo:block-container margin-left="0mm">
@@ -5941,7 +6174,16 @@
5941
6174
  </fo:inline>
5942
6175
  </xsl:when>
5943
6176
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5944
- <fo:inline><xsl:apply-templates/></fo:inline>
6177
+
6178
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
6179
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
6180
+ <xsl:choose>
6181
+ <xsl:when test="$uri_src != ''">
6182
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
6183
+ </xsl:when>
6184
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
6185
+ </xsl:choose>
6186
+
5945
6187
  </xsl:otherwise>
5946
6188
  </xsl:choose>
5947
6189
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6122,10 +6364,24 @@
6122
6364
 
6123
6365
  </fo:block>
6124
6366
  <xsl:apply-templates/>
6125
- </xsl:template><xsl:template match="*[local-name() = 'review']">
6367
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
6126
6368
  <!-- comment 2019-11-29 -->
6127
6369
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6128
6370
  <xsl:apply-templates /> -->
6371
+
6372
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
6373
+
6374
+ <xsl:choose>
6375
+ <!-- if there isn't the attribute '@from', then -->
6376
+ <xsl:when test="$id_from = ''">
6377
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6378
+ </xsl:when>
6379
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
6380
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
6381
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6382
+ </xsl:when>
6383
+ </xsl:choose>
6384
+
6129
6385
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6130
6386
  <!-- 0xA0 to space replacement -->
6131
6387
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6482,7 +6738,10 @@
6482
6738
  <!-- to split by '_' and other chars -->
6483
6739
  <xsl:call-template name="add-zero-spaces-java"/>
6484
6740
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6485
- <fo:inline id="{@id}" font-size="1pt"/>
6741
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6742
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6743
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6744
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
6486
6745
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6487
6746
  <!-- <row>
6488
6747
  <date>05-07-2013</date>
@@ -7000,6 +7259,120 @@
7000
7259
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7001
7260
  </xsl:for-each>
7002
7261
  </xsl:copy>
7262
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
7263
+ <xsl:apply-templates mode="update_xml_step1"/>
7264
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
7265
+ <xsl:copy>
7266
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
7267
+ </xsl:copy>
7268
+ </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">
7269
+
7270
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
7271
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
7272
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7273
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7274
+ <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))"/>
7275
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
7276
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7277
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7278
+ <xsl:with-param name="text" select="$text_"/>
7279
+ </xsl:call-template></text></xsl:variable>
7280
+
7281
+ <xsl:variable name="parent" select="local-name(..)"/>
7282
+
7283
+ <xsl:variable name="text2">
7284
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
7285
+ <xsl:copy-of select="."/>
7286
+ </xsl:for-each></text>
7287
+ </xsl:variable>
7288
+
7289
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
7290
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
7291
+ <xsl:variable name="text3">
7292
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
7293
+ <xsl:choose>
7294
+ <xsl:when test="self::text()">
7295
+ <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))"/>
7296
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
7297
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7298
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7299
+ <xsl:with-param name="text" select="$text_units_"/>
7300
+ </xsl:call-template></text></xsl:variable>
7301
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
7302
+ </xsl:when>
7303
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7304
+ </xsl:choose>
7305
+ </xsl:for-each></text>
7306
+ </xsl:variable>
7307
+
7308
+ <xsl:choose>
7309
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
7310
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
7311
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
7312
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
7313
+ <xsl:choose>
7314
+ <xsl:when test="self::text()">
7315
+ <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))"/>
7316
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
7317
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7318
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7319
+ <xsl:with-param name="text" select="$text_dots_"/>
7320
+ </xsl:call-template></text></xsl:variable>
7321
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
7322
+ </xsl:when>
7323
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7324
+ </xsl:choose>
7325
+ </xsl:for-each>
7326
+ </xsl:when>
7327
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
7328
+ </xsl:choose>
7329
+
7330
+ </xsl:template><xsl:template name="replace_text_tags">
7331
+ <xsl:param name="tag_open"/>
7332
+ <xsl:param name="tag_close"/>
7333
+ <xsl:param name="text"/>
7334
+ <xsl:choose>
7335
+ <xsl:when test="contains($text, $tag_open)">
7336
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
7337
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
7338
+
7339
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
7340
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
7341
+ </xsl:element>
7342
+
7343
+ <xsl:call-template name="replace_text_tags">
7344
+ <xsl:with-param name="tag_open" select="$tag_open"/>
7345
+ <xsl:with-param name="tag_close" select="$tag_close"/>
7346
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
7347
+ </xsl:call-template>
7348
+ </xsl:when>
7349
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7350
+ </xsl:choose>
7351
+ </xsl:template><xsl:template name="printEdition">
7352
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7353
+ <xsl:text> </xsl:text>
7354
+ <xsl:choose>
7355
+ <xsl:when test="$edition_i18n != ''">
7356
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
7357
+ <xsl:call-template name="capitalize">
7358
+ <xsl:with-param name="str" select="$edition_i18n"/>
7359
+ </xsl:call-template>
7360
+ </xsl:when>
7361
+ <xsl:otherwise>
7362
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
7363
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
7364
+ <xsl:call-template name="capitalize">
7365
+ <xsl:with-param name="str">
7366
+ <xsl:call-template name="getLocalizedString">
7367
+ <xsl:with-param name="key">edition</xsl:with-param>
7368
+ </xsl:call-template>
7369
+ </xsl:with-param>
7370
+ </xsl:call-template>
7371
+ <xsl:text> </xsl:text>
7372
+ <xsl:value-of select="$edition"/>
7373
+ </xsl:if>
7374
+ </xsl:otherwise>
7375
+ </xsl:choose>
7003
7376
  </xsl:template><xsl:template name="convertDate">
7004
7377
  <xsl:param name="date"/>
7005
7378
  <xsl:param name="format" select="'short'"/>