metanorma-un 0.8.8 → 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.
@@ -833,7 +833,7 @@
833
833
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJNaWNyb3NvZnTCriBXb3JkIDIwMTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzM0NUVBQ0U2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzM0NUVBQ0Y2RUMzMTFFQUIzQjg4RDg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kCd9g6NQAQPIi8vz4f5o72tANZVgO/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>
834
834
  </xsl:variable>
835
835
 
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: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">
837
837
  <xsl:call-template name="getLang"/>
838
838
  </xsl:variable><xsl:variable name="pageWidth_">
839
839
  210
@@ -848,20 +848,7 @@
848
848
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
849
849
  40
850
850
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
851
-
852
- <title-edition lang="en">
853
-
854
- <xsl:text>Edition </xsl:text>
855
-
856
- </title-edition>
857
851
 
858
- <title-edition lang="fr">
859
- <xsl:text>Édition </xsl:text>
860
- </title-edition>
861
-
862
- <title-edition lang="ru">
863
- <xsl:text>Издание </xsl:text>
864
- </title-edition>
865
852
 
866
853
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
867
854
  <title-toc lang="en">
@@ -940,7 +927,7 @@
940
927
  </xsl:variable><xsl:variable name="bibdata">
941
928
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
942
929
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
943
- </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">
944
931
  <xsl:param name="name"/>
945
932
  <xsl:param name="lang"/>
946
933
  <xsl:variable name="lang_">
@@ -988,7 +975,7 @@
988
975
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
989
976
 
990
977
  <xsl:variable name="additional_fonts_">
991
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
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']">
992
979
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
993
980
  </xsl:for-each>
994
981
  </xsl:variable>
@@ -1060,7 +1047,6 @@
1060
1047
 
1061
1048
 
1062
1049
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
1063
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1064
1050
 
1065
1051
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1066
1052
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -1140,6 +1126,7 @@
1140
1126
 
1141
1127
 
1142
1128
 
1129
+
1143
1130
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1144
1131
 
1145
1132
 
@@ -2217,22 +2204,32 @@
2217
2204
  <xsl:sort select="@displayorder" data-type="number"/>
2218
2205
  <xsl:apply-templates select="."/>
2219
2206
  </xsl:for-each>
2220
- </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">
2221
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2222
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2223
- <xsl:call-template name="replace_fo_inline">
2224
- <xsl:with-param name="text" select="$text"/>
2225
- </xsl:call-template>
2226
- </xsl:template><xsl:template name="replace_fo_inline">
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"/>
2227
2220
  <xsl:param name="text"/>
2228
2221
  <xsl:choose>
2229
2222
  <xsl:when test="contains($text, $tag_open)">
2230
2223
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2231
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2224
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2232
2225
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2233
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2234
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2235
- <xsl:call-template name="replace_fo_inline">
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"/>
2236
2233
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2237
2234
  </xsl:call-template>
2238
2235
  </xsl:when>
@@ -2240,6 +2237,8 @@
2240
2237
  </xsl:choose>
2241
2238
  </xsl:template><xsl:template match="*[local-name()='br']">
2242
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>
2243
2242
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
2244
2243
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
2245
2244
  <xsl:apply-templates/>
@@ -2305,8 +2304,23 @@
2305
2304
  </xsl:call-template>
2306
2305
 
2307
2306
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2308
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2309
- <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>
2310
2324
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2311
2325
 
2312
2326
  <xsl:variable name="table-preamble">
@@ -2435,16 +2449,9 @@
2435
2449
  </xsl:for-each>
2436
2450
  </xsl:when>
2437
2451
  <xsl:otherwise>
2438
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2439
- <xsl:choose>
2440
- <xsl:when test=". = 1 or . = 0">
2441
- <fo:table-column column-width="proportional-column-width(2)"/>
2442
- </xsl:when>
2443
- <xsl:otherwise>
2444
- <fo:table-column column-width="proportional-column-width({.})"/>
2445
- </xsl:otherwise>
2446
- </xsl:choose>
2447
- </xsl:for-each>
2452
+ <xsl:call-template name="insertTableColumnWidth">
2453
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2454
+ </xsl:call-template>
2448
2455
  </xsl:otherwise>
2449
2456
  </xsl:choose>
2450
2457
 
@@ -2605,6 +2612,7 @@
2605
2612
  <xsl:with-param name="text" select="$td_text"/>
2606
2613
  </xsl:call-template>
2607
2614
  </xsl:variable>
2615
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2608
2616
  <xsl:call-template name="tokenize">
2609
2617
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2610
2618
  <!-- 2009 thinspace -->
@@ -2617,6 +2625,7 @@
2617
2625
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2618
2626
  </xsl:call-template>
2619
2627
  </xsl:variable>
2628
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2620
2629
  <width>
2621
2630
  <xsl:variable name="divider">
2622
2631
  <xsl:choose>
@@ -2649,6 +2658,10 @@
2649
2658
  <xsl:with-param name="table" select="$table"/>
2650
2659
  </xsl:call-template>
2651
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')"/>
2652
2665
  </xsl:template><xsl:template match="text()" mode="td_text">
2653
2666
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2654
2667
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -2750,16 +2763,9 @@
2750
2763
  </xsl:for-each>
2751
2764
  </xsl:when>
2752
2765
  <xsl:otherwise>
2753
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2754
- <xsl:choose>
2755
- <xsl:when test=". = 1 or . = 0">
2756
- <fo:table-column column-width="proportional-column-width(2)"/>
2757
- </xsl:when>
2758
- <xsl:otherwise>
2759
- <fo:table-column column-width="proportional-column-width({.})"/>
2760
- </xsl:otherwise>
2761
- </xsl:choose>
2762
- </xsl:for-each>
2766
+ <xsl:call-template name="insertTableColumnWidth">
2767
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2768
+ </xsl:call-template>
2763
2769
  </xsl:otherwise>
2764
2770
  </xsl:choose>
2765
2771
 
@@ -3308,8 +3314,10 @@
3308
3314
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3309
3315
  </xsl:variable>
3310
3316
 
3317
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3318
+
3311
3319
  <xsl:choose>
3312
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3320
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3313
3321
 
3314
3322
  <fo:block margin-bottom="12pt" text-align="left">
3315
3323
 
@@ -3324,7 +3332,7 @@
3324
3332
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3325
3333
  </fo:block>
3326
3334
 
3327
- </xsl:when>
3335
+ </xsl:when> <!-- END: only one component -->
3328
3336
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3329
3337
  <fo:block margin-bottom="12pt" text-align="left">
3330
3338
 
@@ -3338,8 +3346,8 @@
3338
3346
  </xsl:variable>
3339
3347
  <xsl:value-of select="$title-where"/>
3340
3348
  </fo:block>
3341
- </xsl:when>
3342
- <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 -->
3343
3351
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3344
3352
 
3345
3353
 
@@ -3352,11 +3360,11 @@
3352
3360
  </xsl:variable>
3353
3361
  <xsl:value-of select="$title-key"/>
3354
3362
  </fo:block>
3355
- </xsl:when>
3363
+ </xsl:when> <!-- END: definition list in a figure -->
3356
3364
  </xsl:choose>
3357
3365
 
3358
3366
  <!-- a few components -->
3359
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3367
+ <xsl:if test="$onlyOneComponent = 'false'">
3360
3368
  <fo:block>
3361
3369
 
3362
3370
 
@@ -3395,21 +3403,28 @@
3395
3403
  <xsl:apply-templates mode="dl"/>
3396
3404
  </tbody>
3397
3405
  </xsl:variable>
3398
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3406
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3399
3407
  <xsl:variable name="colwidths">
3400
3408
  <xsl:call-template name="calculate-column-widths">
3401
3409
  <xsl:with-param name="cols-count" select="2"/>
3402
3410
  <xsl:with-param name="table" select="$html-table"/>
3403
3411
  </xsl:call-template>
3404
3412
  </xsl:variable>
3405
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3413
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3406
3414
  <xsl:variable name="maxlength_dt">
3407
3415
  <xsl:call-template name="getMaxLength_dt"/>
3408
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"/> -->
3409
3422
  <xsl:call-template name="setColumnWidth_dl">
3410
3423
  <xsl:with-param name="colwidths" select="$colwidths"/>
3411
3424
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3425
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3412
3426
  </xsl:call-template>
3427
+
3413
3428
  <fo:table-body>
3414
3429
  <xsl:apply-templates>
3415
3430
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3418,12 +3433,13 @@
3418
3433
  </fo:table>
3419
3434
  </fo:block>
3420
3435
  </fo:block>
3421
- </xsl:if>
3436
+ </xsl:if> <!-- END: a few components -->
3422
3437
  </fo:block-container>
3423
3438
  </fo:block-container>
3424
3439
  </xsl:template><xsl:template name="setColumnWidth_dl">
3425
3440
  <xsl:param name="colwidths"/>
3426
3441
  <xsl:param name="maxlength_dt"/>
3442
+ <xsl:param name="isContainsKeepTogetherTag"/>
3427
3443
  <xsl:choose>
3428
3444
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3429
3445
  <fo:table-column column-width="50%"/>
@@ -3431,6 +3447,11 @@
3431
3447
  </xsl:when>
3432
3448
  <xsl:otherwise>
3433
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>
3434
3455
  <!-- to set width check most wide chars like `W` -->
3435
3456
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3436
3457
  <fo:table-column column-width="7%"/>
@@ -3461,20 +3482,25 @@
3461
3482
  <fo:table-column column-width="60%"/>
3462
3483
  </xsl:when>
3463
3484
  <xsl:otherwise>
3464
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3465
- <xsl:choose>
3466
- <xsl:when test=". = 1 or . = 0">
3467
- <fo:table-column column-width="proportional-column-width(2)"/>
3468
- </xsl:when>
3469
- <xsl:otherwise>
3470
- <fo:table-column column-width="proportional-column-width({.})"/>
3471
- </xsl:otherwise>
3472
- </xsl:choose>
3473
- </xsl:for-each>
3485
+ <xsl:call-template name="insertTableColumnWidth">
3486
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3487
+ </xsl:call-template>
3474
3488
  </xsl:otherwise>
3475
3489
  </xsl:choose>
3476
3490
  </xsl:otherwise>
3477
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>
3478
3504
  </xsl:template><xsl:template name="getMaxLength_dt">
3479
3505
  <xsl:variable name="lengths">
3480
3506
  <xsl:for-each select="*[local-name()='dt']">
@@ -3498,7 +3524,6 @@
3498
3524
  <xsl:value-of select="$maxLength"/>
3499
3525
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3500
3526
  <xsl:param name="key_iso"/>
3501
-
3502
3527
  <!-- <tr>
3503
3528
  <td>NOTE</td>
3504
3529
  <td>
@@ -3506,18 +3531,30 @@
3506
3531
  </td>
3507
3532
  </tr>
3508
3533
  -->
3509
- <fo:table-row>
3534
+ <!-- OLD Variant -->
3535
+ <!-- <fo:table-row>
3510
3536
  <fo:table-cell>
3511
3537
  <fo:block margin-top="6pt">
3512
3538
  <xsl:if test="normalize-space($key_iso) = 'true'">
3513
3539
  <xsl:attribute name="margin-top">0</xsl:attribute>
3514
3540
  </xsl:if>
3515
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3541
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3516
3542
  </fo:block>
3517
3543
  </fo:table-cell>
3518
3544
  <fo:table-cell>
3519
3545
  <fo:block>
3520
- <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"/>
3521
3558
  </fo:block>
3522
3559
  </fo:table-cell>
3523
3560
  </fo:table-row>
@@ -3619,13 +3656,15 @@
3619
3656
  <xsl:choose>
3620
3657
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3621
3658
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3622
- <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>
3623
3660
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3624
3661
  </xsl:choose>
3625
3662
  </xsl:attribute>
3626
3663
  </xsl:if>
3627
3664
  <xsl:apply-templates/>
3628
3665
  </fo:inline>
3666
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
3667
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3629
3668
  </xsl:template><xsl:template match="*[local-name()='underline']">
3630
3669
  <fo:inline text-decoration="underline">
3631
3670
  <xsl:apply-templates/>
@@ -3773,41 +3812,50 @@
3773
3812
  <fo:block break-after="page"/>
3774
3813
  <fo:block> </fo:block>
3775
3814
  <fo:block break-after="page"/>
3815
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
3816
+ <xsl:apply-templates/>
3776
3817
  </xsl:template><xsl:template name="tokenize">
3777
3818
  <xsl:param name="text"/>
3778
3819
  <xsl:param name="separator" select="' '"/>
3779
3820
  <xsl:choose>
3780
3821
  <xsl:when test="not(contains($text, $separator))">
3781
3822
  <word>
3782
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3783
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3784
3823
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3785
- <xsl:variable name="len_str">
3786
- <xsl:choose>
3787
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3788
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3789
- </xsl:when>
3790
- <xsl:otherwise>
3791
- <xsl:value-of select="$len_str_tmp"/>
3792
- </xsl:otherwise>
3793
- </xsl:choose>
3794
- </xsl:variable>
3795
-
3796
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3797
- <xsl:message>
3798
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3799
- len_str=<xsl:value-of select="$len_str"/>
3800
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3801
- </xsl:message>
3802
- </xsl:if> -->
3803
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3804
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3805
3824
  <xsl:choose>
3806
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3807
- <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"/>
3808
3827
  </xsl:when>
3809
3828
  <xsl:otherwise>
3810
- <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>
3811
3859
  </xsl:otherwise>
3812
3860
  </xsl:choose>
3813
3861
  </word>
@@ -4082,6 +4130,9 @@
4082
4130
  <xsl:variable name="isDeleted" select="@deleted"/>
4083
4131
 
4084
4132
  <fo:inline xsl:use-attribute-sets="mathml-style">
4133
+
4134
+
4135
+
4085
4136
 
4086
4137
 
4087
4138
  <xsl:call-template name="setTrackChangesStyles">
@@ -4089,48 +4140,80 @@
4089
4140
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4090
4141
  </xsl:call-template>
4091
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>
4092
4149
 
4093
-
4094
- <xsl:variable name="mathml">
4095
- <xsl:apply-templates select="." mode="mathml"/>
4150
+ <xsl:variable name="mathml_content">
4151
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4096
4152
  </xsl:variable>
4097
- <fo:instream-foreign-object fox:alt-text="Math">
4098
4153
 
4154
+
4155
+ <xsl:call-template name="mathml_instream_object">
4156
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4157
+ </xsl:call-template>
4099
4158
 
4100
-
4101
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4102
- <xsl:variable name="comment_text_">
4103
- <xsl:choose>
4104
- <xsl:when test="normalize-space($comment_text_following) != ''">
4105
- <xsl:value-of select="$comment_text_following"/>
4106
- </xsl:when>
4107
- <xsl:otherwise>
4108
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4109
- </xsl:otherwise>
4110
- </xsl:choose>
4111
- </xsl:variable>
4112
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4113
-
4114
- <xsl:if test="normalize-space($comment_text) != ''">
4115
- <!-- put Mathin Alternate Text -->
4116
- <xsl:attribute name="fox:alt-text">
4117
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4118
- </xsl:attribute>
4119
- </xsl:if>
4120
-
4121
- <xsl:variable name="mathml_content">
4122
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4123
- </xsl:variable>
4124
- <!-- put MathML in Actual Text -->
4125
- <xsl:attribute name="fox:actual-text">
4126
- <xsl:value-of select="$mathml_content"/>
4127
- </xsl:attribute>
4128
-
4129
-
4130
-
4131
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4132
- </fo:instream-foreign-object>
4159
+
4133
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>
4134
4217
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4135
4218
  <!-- <xsl:text>a+b</xsl:text> -->
4136
4219
  <xsl:text>&lt;</xsl:text>
@@ -4161,7 +4244,9 @@
4161
4244
  <!-- replace start and end spaces to non-break space -->
4162
4245
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4163
4246
  </xsl:copy>
4164
- </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">
4165
4250
  <xsl:variable name="target">
4166
4251
  <xsl:choose>
4167
4252
  <xsl:when test="@updatetype = 'true'">
@@ -4770,18 +4855,33 @@
4770
4855
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4771
4856
  <xsl:copy>
4772
4857
  <xsl:apply-templates select="@*" mode="svg_update"/>
4773
- <xsl:variable name="viewbox">
4858
+ <xsl:variable name="viewbox_">
4774
4859
  <xsl:call-template name="split">
4775
4860
  <xsl:with-param name="pText" select="@viewBox"/>
4776
4861
  <xsl:with-param name="sep" select="' '"/>
4777
4862
  </xsl:call-template>
4778
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
+
4779
4868
  <xsl:attribute name="width">
4780
- <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>
4781
4875
  </xsl:attribute>
4782
4876
  <xsl:attribute name="height">
4783
- <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>
4784
4883
  </xsl:attribute>
4884
+
4785
4885
  <xsl:apply-templates mode="svg_update"/>
4786
4886
  </xsl:copy>
4787
4887
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4976,7 +5076,11 @@
4976
5076
  <xsl:apply-templates mode="bookmarks"/>
4977
5077
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4978
5078
  <xsl:apply-templates select="."/>
4979
- </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">
4980
5084
  <xsl:apply-templates mode="bookmarks"/>
4981
5085
  </xsl:template><xsl:template name="addBookmarks">
4982
5086
  <xsl:param name="contents"/>
@@ -5258,7 +5362,9 @@
5258
5362
  <xsl:apply-templates/>
5259
5363
  </xsl:otherwise>
5260
5364
  </xsl:choose>
5261
- </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">
5262
5368
  <xsl:text> </xsl:text>
5263
5369
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
5264
5370
  <xsl:copy>
@@ -5289,9 +5395,22 @@
5289
5395
  </xsl:when>
5290
5396
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
5291
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"/>
5292
5402
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5293
5403
 
5294
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
+
5295
5414
  <xsl:copy-of select="@id"/>
5296
5415
 
5297
5416
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5769,39 +5888,67 @@
5769
5888
  </xsl:otherwise>
5770
5889
  </xsl:choose>
5771
5890
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5772
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5773
-
5891
+
5892
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
5893
+
5774
5894
 
5895
+
5775
5896
  <xsl:variable name="fo_element">
5776
- <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>
5777
5898
  block
5778
5899
  </xsl:variable>
5779
5900
 
5780
- <!-- display 'EXAMPLE' -->
5781
- <xsl:apply-templates select="*[local-name()='name']">
5782
- <xsl:with-param name="fo_element" select="$fo_element"/>
5783
- </xsl:apply-templates>
5901
+ <fo:block-container margin-left="0mm">
5784
5902
 
5785
- <xsl:choose>
5786
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5787
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5788
- <fo:block-container margin-left="0mm" margin-right="0mm">
5789
- <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']">
5790
5910
  <xsl:with-param name="fo_element" select="$fo_element"/>
5791
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>
5792
5920
  </fo:block-container>
5793
- </fo:block-container>
5794
- </xsl:when>
5795
- <xsl:otherwise>
5796
- <fo:inline>
5797
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5798
- <xsl:with-param name="fo_element" select="$fo_element"/>
5799
- </xsl:apply-templates>
5800
- </fo:inline>
5801
- </xsl:otherwise>
5802
- </xsl:choose>
5803
-
5804
- </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>
5805
5952
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5806
5953
  <xsl:param name="fo_element">block</xsl:param>
5807
5954
 
@@ -5833,14 +5980,20 @@
5833
5980
  </xsl:variable>
5834
5981
  <xsl:choose>
5835
5982
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5836
- <fo:block xsl:use-attribute-sets="example-p-style">
5837
-
5838
- <xsl:if test="$num = 1">
5839
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
5840
- </xsl:if>
5841
-
5842
- <xsl:apply-templates/>
5843
- </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>
5844
5997
  </xsl:when>
5845
5998
  <xsl:otherwise>
5846
5999
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -6021,7 +6174,16 @@
6021
6174
  </fo:inline>
6022
6175
  </xsl:when>
6023
6176
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6024
- <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
+
6025
6187
  </xsl:otherwise>
6026
6188
  </xsl:choose>
6027
6189
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -6202,10 +6364,24 @@
6202
6364
 
6203
6365
  </fo:block>
6204
6366
  <xsl:apply-templates/>
6205
- </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 -->
6206
6368
  <!-- comment 2019-11-29 -->
6207
6369
  <!-- <fo:block font-weight="bold">Review:</fo:block>
6208
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
+
6209
6385
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6210
6386
  <!-- 0xA0 to space replacement -->
6211
6387
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6562,7 +6738,10 @@
6562
6738
  <!-- to split by '_' and other chars -->
6563
6739
  <xsl:call-template name="add-zero-spaces-java"/>
6564
6740
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6565
- <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>
6566
6745
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6567
6746
  <!-- <row>
6568
6747
  <date>05-07-2013</date>
@@ -7080,6 +7259,120 @@
7080
7259
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7081
7260
  </xsl:for-each>
7082
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>
7083
7376
  </xsl:template><xsl:template name="convertDate">
7084
7377
  <xsl:param name="date"/>
7085
7378
  <xsl:param name="format" select="'short'"/>