metanorma-cc 2.0.8 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4e32f9f56124c2b505b0c200b08218fe707fdfcf6a5a90eb2cb8be3c303ab6e
4
- data.tar.gz: a0c8c48ff1a1150c8a4ec42c7db5f22bdef611269b2ae4977eed54ce0b5181fc
3
+ metadata.gz: 7c12ac169b1cc0e2ffe7f7037b2241919eae255a5ed129c72ac5423f7edd0540
4
+ data.tar.gz: cd0da16af312f9d529c172ca04611f2e36efb24eb80b1af5cbe70de184cc62b4
5
5
  SHA512:
6
- metadata.gz: 7ffa0ec8f2ae42a01735fec0ec2b9b528aa7a530ebe219b371a56d48c85893a373d7473ed46f95950b312bca2d76bdf89400833cfcc79f35e6cf5f07ffc14538
7
- data.tar.gz: 7500c23346c84d5de86c11fecbc8888b0b52c1cdab2f66cd7b12322ea3cf4e574e339e6d293a52d421d023e8462c617cf7b933a2c1805c6146dde15243b155d0
6
+ metadata.gz: 927433a9e65cc953e7bd392312333492599ff8ce9ef1ae19317fa79984133a5c39516cacac78e5b058fbf34db9f35ee98e1e773993f5337a6c1b2b3094e64e6e
7
+ data.tar.gz: f3889f49e1bb2bec3d9898c63cce99bbf14731ed6e2990102d06776ebd75ca05f075b7d9dc6b50be634dd451cea42df1b4baee3aa71af2ec80fc7711e91d0831
@@ -566,7 +566,7 @@
566
566
  </xsl:template>
567
567
 
568
568
 
569
- <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">
569
+ <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">
570
570
  <xsl:call-template name="getLang"/>
571
571
  </xsl:variable><xsl:variable name="pageWidth_">
572
572
  210
@@ -581,20 +581,7 @@
581
581
  </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
582
582
  20.3
583
583
  </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
584
-
585
- <title-edition lang="en">
586
-
587
- <xsl:text>Edition </xsl:text>
588
-
589
- </title-edition>
590
584
 
591
- <title-edition lang="fr">
592
- <xsl:text>Édition </xsl:text>
593
- </title-edition>
594
-
595
- <title-edition lang="ru">
596
- <xsl:text>Издание </xsl:text>
597
- </title-edition>
598
585
 
599
586
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
600
587
  <title-toc lang="en">
@@ -675,7 +662,7 @@
675
662
  </xsl:variable><xsl:variable name="bibdata">
676
663
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
677
664
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
678
- </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">
665
+ </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">
679
666
  <xsl:param name="name"/>
680
667
  <xsl:param name="lang"/>
681
668
  <xsl:variable name="lang_">
@@ -723,7 +710,7 @@
723
710
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
724
711
 
725
712
  <xsl:variable name="additional_fonts_">
726
- <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
713
+ <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']">
727
714
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
728
715
  </xsl:for-each>
729
716
  </xsl:variable>
@@ -798,7 +785,6 @@
798
785
 
799
786
 
800
787
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
801
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
802
788
 
803
789
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
804
790
  <xsl:attribute name="white-space">pre</xsl:attribute>
@@ -885,6 +871,7 @@
885
871
 
886
872
 
887
873
 
874
+
888
875
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
889
876
 
890
877
 
@@ -1944,22 +1931,32 @@
1944
1931
  <xsl:sort select="@displayorder" data-type="number"/>
1945
1932
  <xsl:apply-templates select="."/>
1946
1933
  </xsl:for-each>
1947
- </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">
1948
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
1949
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
1950
- <xsl:call-template name="replace_fo_inline">
1951
- <xsl:with-param name="text" select="$text"/>
1952
- </xsl:call-template>
1953
- </xsl:template><xsl:template name="replace_fo_inline">
1934
+ </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">
1935
+
1936
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
1937
+ <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))"/>
1938
+ <xsl:call-template name="replace_fo_inline_tags">
1939
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
1940
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
1941
+ <xsl:with-param name="text" select="$text"/>
1942
+ </xsl:call-template>
1943
+
1944
+ </xsl:template><xsl:template name="replace_fo_inline_tags">
1945
+ <xsl:param name="tag_open"/>
1946
+ <xsl:param name="tag_close"/>
1954
1947
  <xsl:param name="text"/>
1955
1948
  <xsl:choose>
1956
1949
  <xsl:when test="contains($text, $tag_open)">
1957
1950
  <xsl:value-of select="substring-before($text, $tag_open)"/>
1958
- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
1951
+ <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
1959
1952
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
1960
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
1961
- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
1962
- <xsl:call-template name="replace_fo_inline">
1953
+ <fo:inline keep-together.within-line="always">
1954
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
1955
+ </fo:inline>
1956
+ <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
1957
+ <xsl:call-template name="replace_fo_inline_tags">
1958
+ <xsl:with-param name="tag_open" select="$tag_open"/>
1959
+ <xsl:with-param name="tag_close" select="$tag_close"/>
1963
1960
  <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
1964
1961
  </xsl:call-template>
1965
1962
  </xsl:when>
@@ -1967,6 +1964,8 @@
1967
1964
  </xsl:choose>
1968
1965
  </xsl:template><xsl:template match="*[local-name()='br']">
1969
1966
  <xsl:value-of select="$linebreak"/>
1967
+ </xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
1968
+ <fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
1970
1969
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
1971
1970
  <fo:block xsl:use-attribute-sets="copyright-statement-style">
1972
1971
  <xsl:apply-templates/>
@@ -2032,8 +2031,23 @@
2032
2031
  </xsl:call-template>
2033
2032
 
2034
2033
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2035
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2036
- <xsl:call-template name="add-zero-spaces-java"/>
2034
+ <xsl:choose>
2035
+ <xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
2036
+ <xsl:value-of select="."/>
2037
+ </xsl:when>
2038
+ <xsl:otherwise>
2039
+ <xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
2040
+ </xsl:otherwise>
2041
+ </xsl:choose>
2042
+ </xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
2043
+ <xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
2044
+ <!-- <xsl:copy-of select="$text"/> -->
2045
+ <xsl:for-each select="xalan:nodeset($text)/text/node()">
2046
+ <xsl:choose>
2047
+ <xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
2048
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
2049
+ </xsl:choose>
2050
+ </xsl:for-each>
2037
2051
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2038
2052
 
2039
2053
  <xsl:variable name="table-preamble">
@@ -2157,16 +2171,9 @@
2157
2171
  </xsl:for-each>
2158
2172
  </xsl:when>
2159
2173
  <xsl:otherwise>
2160
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2161
- <xsl:choose>
2162
- <xsl:when test=". = 1 or . = 0">
2163
- <fo:table-column column-width="proportional-column-width(2)"/>
2164
- </xsl:when>
2165
- <xsl:otherwise>
2166
- <fo:table-column column-width="proportional-column-width({.})"/>
2167
- </xsl:otherwise>
2168
- </xsl:choose>
2169
- </xsl:for-each>
2174
+ <xsl:call-template name="insertTableColumnWidth">
2175
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2176
+ </xsl:call-template>
2170
2177
  </xsl:otherwise>
2171
2178
  </xsl:choose>
2172
2179
 
@@ -2330,6 +2337,7 @@
2330
2337
  <xsl:with-param name="text" select="$td_text"/>
2331
2338
  </xsl:call-template>
2332
2339
  </xsl:variable>
2340
+ <!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
2333
2341
  <xsl:call-template name="tokenize">
2334
2342
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2335
2343
  <!-- 2009 thinspace -->
@@ -2342,6 +2350,7 @@
2342
2350
  <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2343
2351
  </xsl:call-template>
2344
2352
  </xsl:variable>
2353
+ <!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
2345
2354
  <width>
2346
2355
  <xsl:variable name="divider">
2347
2356
  <xsl:choose>
@@ -2374,6 +2383,10 @@
2374
2383
  <xsl:with-param name="table" select="$table"/>
2375
2384
  </xsl:call-template>
2376
2385
  </xsl:if>
2386
+ </xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
2387
+ <!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
2388
+ <xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
2389
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
2377
2390
  </xsl:template><xsl:template match="text()" mode="td_text">
2378
2391
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2379
2392
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -2475,16 +2488,9 @@
2475
2488
  </xsl:for-each>
2476
2489
  </xsl:when>
2477
2490
  <xsl:otherwise>
2478
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2479
- <xsl:choose>
2480
- <xsl:when test=". = 1 or . = 0">
2481
- <fo:table-column column-width="proportional-column-width(2)"/>
2482
- </xsl:when>
2483
- <xsl:otherwise>
2484
- <fo:table-column column-width="proportional-column-width({.})"/>
2485
- </xsl:otherwise>
2486
- </xsl:choose>
2487
- </xsl:for-each>
2491
+ <xsl:call-template name="insertTableColumnWidth">
2492
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2493
+ </xsl:call-template>
2488
2494
  </xsl:otherwise>
2489
2495
  </xsl:choose>
2490
2496
 
@@ -3025,8 +3031,10 @@
3025
3031
  <!-- and (not(../@class) or ../@class !='pseudocode') -->
3026
3032
  </xsl:variable>
3027
3033
 
3034
+ <xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
3035
+
3028
3036
  <xsl:choose>
3029
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3037
+ <xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
3030
3038
 
3031
3039
  <fo:block margin-bottom="12pt" text-align="left">
3032
3040
 
@@ -3041,7 +3049,7 @@
3041
3049
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3042
3050
  </fo:block>
3043
3051
 
3044
- </xsl:when>
3052
+ </xsl:when> <!-- END: only one component -->
3045
3053
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3046
3054
  <fo:block margin-bottom="12pt" text-align="left">
3047
3055
 
@@ -3055,8 +3063,8 @@
3055
3063
  </xsl:variable>
3056
3064
  <xsl:value-of select="$title-where"/>
3057
3065
  </fo:block>
3058
- </xsl:when>
3059
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3066
+ </xsl:when> <!-- END: a few components -->
3067
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3060
3068
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3061
3069
 
3062
3070
 
@@ -3069,11 +3077,11 @@
3069
3077
  </xsl:variable>
3070
3078
  <xsl:value-of select="$title-key"/>
3071
3079
  </fo:block>
3072
- </xsl:when>
3080
+ </xsl:when> <!-- END: definition list in a figure -->
3073
3081
  </xsl:choose>
3074
3082
 
3075
3083
  <!-- a few components -->
3076
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3084
+ <xsl:if test="$onlyOneComponent = 'false'">
3077
3085
  <fo:block>
3078
3086
 
3079
3087
 
@@ -3112,21 +3120,28 @@
3112
3120
  <xsl:apply-templates mode="dl"/>
3113
3121
  </tbody>
3114
3122
  </xsl:variable>
3115
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3123
+ <!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
3116
3124
  <xsl:variable name="colwidths">
3117
3125
  <xsl:call-template name="calculate-column-widths">
3118
3126
  <xsl:with-param name="cols-count" select="2"/>
3119
3127
  <xsl:with-param name="table" select="$html-table"/>
3120
3128
  </xsl:call-template>
3121
3129
  </xsl:variable>
3122
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3130
+ <!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
3123
3131
  <xsl:variable name="maxlength_dt">
3124
3132
  <xsl:call-template name="getMaxLength_dt"/>
3125
3133
  </xsl:variable>
3134
+ <xsl:variable name="isContainsKeepTogetherTag_">
3135
+ false
3136
+ </xsl:variable>
3137
+ <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
3138
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3126
3139
  <xsl:call-template name="setColumnWidth_dl">
3127
3140
  <xsl:with-param name="colwidths" select="$colwidths"/>
3128
3141
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3142
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
3129
3143
  </xsl:call-template>
3144
+
3130
3145
  <fo:table-body>
3131
3146
  <xsl:apply-templates>
3132
3147
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3135,12 +3150,13 @@
3135
3150
  </fo:table>
3136
3151
  </fo:block>
3137
3152
  </fo:block>
3138
- </xsl:if>
3153
+ </xsl:if> <!-- END: a few components -->
3139
3154
  </fo:block-container>
3140
3155
  </fo:block-container>
3141
3156
  </xsl:template><xsl:template name="setColumnWidth_dl">
3142
3157
  <xsl:param name="colwidths"/>
3143
3158
  <xsl:param name="maxlength_dt"/>
3159
+ <xsl:param name="isContainsKeepTogetherTag"/>
3144
3160
  <xsl:choose>
3145
3161
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3146
3162
  <fo:table-column column-width="50%"/>
@@ -3148,6 +3164,11 @@
3148
3164
  </xsl:when>
3149
3165
  <xsl:otherwise>
3150
3166
  <xsl:choose>
3167
+ <xsl:when test="$isContainsKeepTogetherTag">
3168
+ <xsl:call-template name="insertTableColumnWidth">
3169
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3170
+ </xsl:call-template>
3171
+ </xsl:when>
3151
3172
  <!-- to set width check most wide chars like `W` -->
3152
3173
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3153
3174
  <fo:table-column column-width="7%"/>
@@ -3178,20 +3199,25 @@
3178
3199
  <fo:table-column column-width="60%"/>
3179
3200
  </xsl:when>
3180
3201
  <xsl:otherwise>
3181
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3182
- <xsl:choose>
3183
- <xsl:when test=". = 1 or . = 0">
3184
- <fo:table-column column-width="proportional-column-width(2)"/>
3185
- </xsl:when>
3186
- <xsl:otherwise>
3187
- <fo:table-column column-width="proportional-column-width({.})"/>
3188
- </xsl:otherwise>
3189
- </xsl:choose>
3190
- </xsl:for-each>
3202
+ <xsl:call-template name="insertTableColumnWidth">
3203
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3204
+ </xsl:call-template>
3191
3205
  </xsl:otherwise>
3192
3206
  </xsl:choose>
3193
3207
  </xsl:otherwise>
3194
3208
  </xsl:choose>
3209
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3210
+ <xsl:param name="colwidths"/>
3211
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3212
+ <xsl:choose>
3213
+ <xsl:when test=". = 1 or . = 0">
3214
+ <fo:table-column column-width="proportional-column-width(2)"/>
3215
+ </xsl:when>
3216
+ <xsl:otherwise>
3217
+ <fo:table-column column-width="proportional-column-width({.})"/>
3218
+ </xsl:otherwise>
3219
+ </xsl:choose>
3220
+ </xsl:for-each>
3195
3221
  </xsl:template><xsl:template name="getMaxLength_dt">
3196
3222
  <xsl:variable name="lengths">
3197
3223
  <xsl:for-each select="*[local-name()='dt']">
@@ -3215,7 +3241,6 @@
3215
3241
  <xsl:value-of select="$maxLength"/>
3216
3242
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3217
3243
  <xsl:param name="key_iso"/>
3218
-
3219
3244
  <!-- <tr>
3220
3245
  <td>NOTE</td>
3221
3246
  <td>
@@ -3223,18 +3248,30 @@
3223
3248
  </td>
3224
3249
  </tr>
3225
3250
  -->
3226
- <fo:table-row>
3251
+ <!-- OLD Variant -->
3252
+ <!-- <fo:table-row>
3227
3253
  <fo:table-cell>
3228
3254
  <fo:block margin-top="6pt">
3229
3255
  <xsl:if test="normalize-space($key_iso) = 'true'">
3230
3256
  <xsl:attribute name="margin-top">0</xsl:attribute>
3231
3257
  </xsl:if>
3232
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3258
+ <xsl:apply-templates select="*[local-name() = 'name']" />
3233
3259
  </fo:block>
3234
3260
  </fo:table-cell>
3235
3261
  <fo:table-cell>
3236
3262
  <fo:block>
3237
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3263
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]" />
3264
+ </fo:block>
3265
+ </fo:table-cell>
3266
+ </fo:table-row> -->
3267
+ <!-- <tr>
3268
+ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
3269
+ </tr>
3270
+ -->
3271
+ <fo:table-row>
3272
+ <fo:table-cell number-columns-spanned="2">
3273
+ <fo:block>
3274
+ <xsl:call-template name="note"/>
3238
3275
  </fo:block>
3239
3276
  </fo:table-cell>
3240
3277
  </fo:table-row>
@@ -3336,13 +3373,15 @@
3336
3373
  <xsl:choose>
3337
3374
  <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3338
3375
  <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3339
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3376
+ <xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3340
3377
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3341
3378
  </xsl:choose>
3342
3379
  </xsl:attribute>
3343
3380
  </xsl:if>
3344
3381
  <xsl:apply-templates/>
3345
3382
  </fo:inline>
3383
+ </xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
3384
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
3346
3385
  </xsl:template><xsl:template match="*[local-name()='underline']">
3347
3386
  <fo:inline text-decoration="underline">
3348
3387
  <xsl:apply-templates/>
@@ -3490,41 +3529,50 @@
3490
3529
  <fo:block break-after="page"/>
3491
3530
  <fo:block> </fo:block>
3492
3531
  <fo:block break-after="page"/>
3532
+ </xsl:template><xsl:template match="*[local-name() = 'span']">
3533
+ <xsl:apply-templates/>
3493
3534
  </xsl:template><xsl:template name="tokenize">
3494
3535
  <xsl:param name="text"/>
3495
3536
  <xsl:param name="separator" select="' '"/>
3496
3537
  <xsl:choose>
3497
3538
  <xsl:when test="not(contains($text, $separator))">
3498
3539
  <word>
3499
- <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3500
- <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3501
3540
  <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3502
- <xsl:variable name="len_str">
3503
- <xsl:choose>
3504
- <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3505
- <xsl:value-of select="$len_str_tmp * 1.5"/>
3506
- </xsl:when>
3507
- <xsl:otherwise>
3508
- <xsl:value-of select="$len_str_tmp"/>
3509
- </xsl:otherwise>
3510
- </xsl:choose>
3511
- </xsl:variable>
3512
-
3513
- <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3514
- <xsl:message>
3515
- div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3516
- len_str=<xsl:value-of select="$len_str"/>
3517
- len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3518
- </xsl:message>
3519
- </xsl:if> -->
3520
- <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3521
- <len_str><xsl:value-of select="$len_str"/></len_str> -->
3522
3541
  <xsl:choose>
3523
- <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3524
- <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3542
+ <xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
3543
+ <xsl:value-of select="$len_str_tmp"/>
3525
3544
  </xsl:when>
3526
3545
  <xsl:otherwise>
3527
- <xsl:value-of select="$len_str"/>
3546
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3547
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3548
+ <xsl:variable name="len_str">
3549
+ <xsl:choose>
3550
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3551
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
3552
+ </xsl:when>
3553
+ <xsl:otherwise>
3554
+ <xsl:value-of select="$len_str_tmp"/>
3555
+ </xsl:otherwise>
3556
+ </xsl:choose>
3557
+ </xsl:variable>
3558
+
3559
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3560
+ <xsl:message>
3561
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3562
+ len_str=<xsl:value-of select="$len_str"/>
3563
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3564
+ </xsl:message>
3565
+ </xsl:if> -->
3566
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3567
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
3568
+ <xsl:choose>
3569
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3570
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3571
+ </xsl:when>
3572
+ <xsl:otherwise>
3573
+ <xsl:value-of select="$len_str"/>
3574
+ </xsl:otherwise>
3575
+ </xsl:choose>
3528
3576
  </xsl:otherwise>
3529
3577
  </xsl:choose>
3530
3578
  </word>
@@ -3799,6 +3847,9 @@
3799
3847
  <xsl:variable name="isDeleted" select="@deleted"/>
3800
3848
 
3801
3849
  <fo:inline xsl:use-attribute-sets="mathml-style">
3850
+
3851
+
3852
+
3802
3853
 
3803
3854
 
3804
3855
  <xsl:call-template name="setTrackChangesStyles">
@@ -3806,48 +3857,80 @@
3806
3857
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3807
3858
  </xsl:call-template>
3808
3859
 
3860
+ <xsl:if test="$add_math_as_text = 'true'">
3861
+ <!-- insert helper tag -->
3862
+ <!-- set unique font-size (fiction) -->
3863
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
3864
+ <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 -->
3865
+ </xsl:if>
3809
3866
 
3810
-
3811
- <xsl:variable name="mathml">
3812
- <xsl:apply-templates select="." mode="mathml"/>
3867
+ <xsl:variable name="mathml_content">
3868
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3813
3869
  </xsl:variable>
3814
- <fo:instream-foreign-object fox:alt-text="Math">
3815
3870
 
3871
+
3872
+ <xsl:call-template name="mathml_instream_object">
3873
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3874
+ </xsl:call-template>
3816
3875
 
3817
-
3818
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3819
- <xsl:variable name="comment_text_">
3820
- <xsl:choose>
3821
- <xsl:when test="normalize-space($comment_text_following) != ''">
3822
- <xsl:value-of select="$comment_text_following"/>
3823
- </xsl:when>
3824
- <xsl:otherwise>
3825
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3826
- </xsl:otherwise>
3827
- </xsl:choose>
3828
- </xsl:variable>
3829
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3830
-
3831
- <xsl:if test="normalize-space($comment_text) != ''">
3832
- <!-- put Mathin Alternate Text -->
3833
- <xsl:attribute name="fox:alt-text">
3834
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3835
- </xsl:attribute>
3836
- </xsl:if>
3837
-
3838
- <xsl:variable name="mathml_content">
3839
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
3840
- </xsl:variable>
3841
- <!-- put MathML in Actual Text -->
3842
- <xsl:attribute name="fox:actual-text">
3843
- <xsl:value-of select="$mathml_content"/>
3844
- </xsl:attribute>
3845
-
3846
-
3847
-
3848
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
3849
- </fo:instream-foreign-object>
3876
+
3850
3877
  </fo:inline>
3878
+ </xsl:template><xsl:template name="getMathml_comment_text">
3879
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3880
+ <xsl:variable name="comment_text_">
3881
+ <xsl:choose>
3882
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3883
+ <xsl:value-of select="$comment_text_following"/>
3884
+ </xsl:when>
3885
+ <xsl:otherwise>
3886
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3887
+ </xsl:otherwise>
3888
+ </xsl:choose>
3889
+ </xsl:variable>
3890
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3891
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
3892
+ <xsl:value-of select="$comment_text"/>
3893
+ </xsl:template><xsl:template name="mathml_instream_object">
3894
+ <xsl:param name="comment_text"/>
3895
+ <xsl:param name="mathml_content"/>
3896
+
3897
+ <xsl:variable name="comment_text_">
3898
+ <xsl:choose>
3899
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
3900
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
3901
+ </xsl:choose>
3902
+ </xsl:variable>
3903
+
3904
+ <xsl:variable name="mathml">
3905
+ <xsl:apply-templates select="." mode="mathml"/>
3906
+ </xsl:variable>
3907
+
3908
+ <fo:instream-foreign-object fox:alt-text="Math">
3909
+
3910
+
3911
+
3912
+
3913
+
3914
+
3915
+
3916
+ <!-- put MathML in Actual Text -->
3917
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
3918
+ <xsl:attribute name="fox:actual-text">
3919
+ <xsl:value-of select="$mathml_content"/>
3920
+ </xsl:attribute>
3921
+
3922
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
3923
+ <xsl:if test="normalize-space($comment_text_) != ''">
3924
+ <!-- put Mathin Alternate Text -->
3925
+ <xsl:attribute name="fox:alt-text">
3926
+ <xsl:value-of select="$comment_text_"/>
3927
+ </xsl:attribute>
3928
+ </xsl:if>
3929
+ <!-- </xsl:if> -->
3930
+
3931
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
3932
+
3933
+ </fo:instream-foreign-object>
3851
3934
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3852
3935
  <!-- <xsl:text>a+b</xsl:text> -->
3853
3936
  <xsl:text>&lt;</xsl:text>
@@ -3878,7 +3961,9 @@
3878
3961
  <!-- replace start and end spaces to non-break space -->
3879
3962
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3880
3963
  </xsl:copy>
3881
- </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">
3964
+ </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">
3965
+ <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
3966
+ </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3882
3967
  <xsl:variable name="target">
3883
3968
  <xsl:choose>
3884
3969
  <xsl:when test="@updatetype = 'true'">
@@ -4469,18 +4554,33 @@
4469
4554
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4470
4555
  <xsl:copy>
4471
4556
  <xsl:apply-templates select="@*" mode="svg_update"/>
4472
- <xsl:variable name="viewbox">
4557
+ <xsl:variable name="viewbox_">
4473
4558
  <xsl:call-template name="split">
4474
4559
  <xsl:with-param name="pText" select="@viewBox"/>
4475
4560
  <xsl:with-param name="sep" select="' '"/>
4476
4561
  </xsl:call-template>
4477
4562
  </xsl:variable>
4563
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
4564
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
4565
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
4566
+
4478
4567
  <xsl:attribute name="width">
4479
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4568
+ <xsl:choose>
4569
+ <xsl:when test="$width != ''">
4570
+ <xsl:value-of select="round($width)"/>
4571
+ </xsl:when>
4572
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
4573
+ </xsl:choose>
4480
4574
  </xsl:attribute>
4481
4575
  <xsl:attribute name="height">
4482
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4576
+ <xsl:choose>
4577
+ <xsl:when test="$height != ''">
4578
+ <xsl:value-of select="round($height)"/>
4579
+ </xsl:when>
4580
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
4581
+ </xsl:choose>
4483
4582
  </xsl:attribute>
4583
+
4484
4584
  <xsl:apply-templates mode="svg_update"/>
4485
4585
  </xsl:copy>
4486
4586
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -4675,7 +4775,11 @@
4675
4775
  <xsl:apply-templates mode="bookmarks"/>
4676
4776
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4677
4777
  <xsl:apply-templates select="."/>
4678
- </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">
4778
+ </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">
4779
+ <xsl:apply-templates mode="contents"/>
4780
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4781
+ <xsl:apply-templates mode="bookmarks"/>
4782
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
4679
4783
  <xsl:apply-templates mode="bookmarks"/>
4680
4784
  </xsl:template><xsl:template name="addBookmarks">
4681
4785
  <xsl:param name="contents"/>
@@ -4957,7 +5061,9 @@
4957
5061
  <xsl:apply-templates/>
4958
5062
  </xsl:otherwise>
4959
5063
  </xsl:choose>
4960
- </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">
5064
+ </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">
5065
+ <xsl:value-of select="."/>
5066
+ </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
4961
5067
  <xsl:text> </xsl:text>
4962
5068
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
4963
5069
  <xsl:copy>
@@ -4988,9 +5094,22 @@
4988
5094
  </xsl:when>
4989
5095
  <xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
4990
5096
  </xsl:choose>
5097
+ </xsl:template><xsl:template match="text()" mode="contents_item">
5098
+ <xsl:call-template name="keep_together_standard_number"/>
5099
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
5100
+ <xsl:apply-templates mode="contents_item"/>
4991
5101
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4992
5102
 
4993
5103
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
5104
+
5105
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
5106
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5107
+ </xsl:if>
5108
+
5109
+ <xsl:if test="ancestor::*[local-name() = 'example']">
5110
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5111
+ </xsl:if>
5112
+
4994
5113
  <xsl:copy-of select="@id"/>
4995
5114
 
4996
5115
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -5468,39 +5587,67 @@
5468
5587
  </xsl:otherwise>
5469
5588
  </xsl:choose>
5470
5589
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5471
- <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5472
-
5590
+
5591
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
5592
+
5473
5593
 
5594
+
5474
5595
  <xsl:variable name="fo_element">
5475
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
5596
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
5476
5597
  block
5477
5598
  </xsl:variable>
5478
5599
 
5479
- <!-- display 'EXAMPLE' -->
5480
- <xsl:apply-templates select="*[local-name()='name']">
5481
- <xsl:with-param name="fo_element" select="$fo_element"/>
5482
- </xsl:apply-templates>
5600
+ <fo:block-container margin-left="0mm">
5483
5601
 
5484
- <xsl:choose>
5485
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
5486
- <fo:block-container xsl:use-attribute-sets="example-body-style">
5487
- <fo:block-container margin-left="0mm" margin-right="0mm">
5488
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5602
+ <xsl:choose>
5603
+
5604
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5605
+
5606
+ <!-- display name 'EXAMPLE' in a separate block -->
5607
+ <fo:block>
5608
+ <xsl:apply-templates select="*[local-name()='name']">
5489
5609
  <xsl:with-param name="fo_element" select="$fo_element"/>
5490
5610
  </xsl:apply-templates>
5611
+ </fo:block>
5612
+
5613
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5614
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5615
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5616
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5617
+ </xsl:apply-templates>
5618
+ </fo:block-container>
5491
5619
  </fo:block-container>
5492
- </fo:block-container>
5493
- </xsl:when>
5494
- <xsl:otherwise>
5495
- <fo:inline>
5496
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5497
- <xsl:with-param name="fo_element" select="$fo_element"/>
5498
- </xsl:apply-templates>
5499
- </fo:inline>
5500
- </xsl:otherwise>
5501
- </xsl:choose>
5502
-
5503
- </fo:block>
5620
+ </xsl:when> <!-- end block -->
5621
+
5622
+ <xsl:otherwise> <!-- inline -->
5623
+
5624
+ <!-- display 'EXAMPLE' and first element in the same line -->
5625
+ <fo:block>
5626
+ <xsl:apply-templates select="*[local-name()='name']">
5627
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5628
+ </xsl:apply-templates>
5629
+ <fo:inline>
5630
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
5631
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5632
+ </xsl:apply-templates>
5633
+ </fo:inline>
5634
+ </fo:block>
5635
+
5636
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
5637
+ <!-- display further elements in blocks -->
5638
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5639
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5640
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
5641
+ <xsl:with-param name="fo_element" select="'block'"/>
5642
+ </xsl:apply-templates>
5643
+ </fo:block-container>
5644
+ </fo:block-container>
5645
+ </xsl:if>
5646
+ </xsl:otherwise> <!-- end inline -->
5647
+
5648
+ </xsl:choose>
5649
+ </fo:block-container>
5650
+ </fo:block-container>
5504
5651
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5505
5652
  <xsl:param name="fo_element">block</xsl:param>
5506
5653
 
@@ -5532,10 +5679,16 @@
5532
5679
  </xsl:variable>
5533
5680
  <xsl:choose>
5534
5681
  <xsl:when test="starts-with(normalize-space($element), 'block')">
5535
- <fo:block xsl:use-attribute-sets="example-p-style">
5536
-
5537
- <xsl:apply-templates/>
5538
- </fo:block>
5682
+ <fo:block-container>
5683
+ <xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
5684
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5685
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5686
+ </xsl:if>
5687
+ <fo:block xsl:use-attribute-sets="example-p-style">
5688
+
5689
+ <xsl:apply-templates/>
5690
+ </fo:block>
5691
+ </fo:block-container>
5539
5692
  </xsl:when>
5540
5693
  <xsl:otherwise>
5541
5694
  <fo:inline xsl:use-attribute-sets="example-p-style">
@@ -5717,7 +5870,16 @@
5717
5870
  </fo:inline>
5718
5871
  </xsl:when>
5719
5872
  <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5720
- <fo:inline><xsl:apply-templates/></fo:inline>
5873
+
5874
+ <!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
5875
+ <xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
5876
+ <xsl:choose>
5877
+ <xsl:when test="$uri_src != ''">
5878
+ <fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
5879
+ </xsl:when>
5880
+ <xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
5881
+ </xsl:choose>
5882
+
5721
5883
  </xsl:otherwise>
5722
5884
  </xsl:choose>
5723
5885
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
@@ -5899,10 +6061,24 @@
5899
6061
 
5900
6062
  </fo:block>
5901
6063
  <xsl:apply-templates/>
5902
- </xsl:template><xsl:template match="*[local-name() = 'review']">
6064
+ </xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
5903
6065
  <!-- comment 2019-11-29 -->
5904
6066
  <!-- <fo:block font-weight="bold">Review:</fo:block>
5905
6067
  <xsl:apply-templates /> -->
6068
+
6069
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
6070
+
6071
+ <xsl:choose>
6072
+ <!-- if there isn't the attribute '@from', then -->
6073
+ <xsl:when test="$id_from = ''">
6074
+ <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6075
+ </xsl:when>
6076
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
6077
+ <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
6078
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
6079
+ </xsl:when>
6080
+ </xsl:choose>
6081
+
5906
6082
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5907
6083
  <!-- 0xA0 to space replacement -->
5908
6084
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -6263,7 +6439,10 @@
6263
6439
  <!-- to split by '_' and other chars -->
6264
6440
  <xsl:call-template name="add-zero-spaces-java"/>
6265
6441
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6266
- <fo:inline id="{@id}" font-size="1pt"/>
6442
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
6443
+ <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
6444
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
6445
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
6267
6446
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6268
6447
  <!-- <row>
6269
6448
  <date>05-07-2013</date>
@@ -6809,6 +6988,120 @@
6809
6988
  <xsl:apply-templates select="." mode="update_xml_step1"/>
6810
6989
  </xsl:for-each>
6811
6990
  </xsl:copy>
6991
+ </xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
6992
+ <xsl:apply-templates mode="update_xml_step1"/>
6993
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
6994
+ <xsl:copy>
6995
+ <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
6996
+ </xsl:copy>
6997
+ </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">
6998
+
6999
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
7000
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
7001
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7002
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
7003
+ <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))"/>
7004
+ <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
7005
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7006
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7007
+ <xsl:with-param name="text" select="$text_"/>
7008
+ </xsl:call-template></text></xsl:variable>
7009
+
7010
+ <xsl:variable name="parent" select="local-name(..)"/>
7011
+
7012
+ <xsl:variable name="text2">
7013
+ <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
7014
+ <xsl:copy-of select="."/>
7015
+ </xsl:for-each></text>
7016
+ </xsl:variable>
7017
+
7018
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
7019
+ <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
7020
+ <xsl:variable name="text3">
7021
+ <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
7022
+ <xsl:choose>
7023
+ <xsl:when test="self::text()">
7024
+ <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))"/>
7025
+ <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
7026
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7027
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7028
+ <xsl:with-param name="text" select="$text_units_"/>
7029
+ </xsl:call-template></text></xsl:variable>
7030
+ <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
7031
+ </xsl:when>
7032
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7033
+ </xsl:choose>
7034
+ </xsl:for-each></text>
7035
+ </xsl:variable>
7036
+
7037
+ <xsl:choose>
7038
+ <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
7039
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
7040
+ <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
7041
+ <xsl:for-each select="xalan:nodeset($text3)/text/node()">
7042
+ <xsl:choose>
7043
+ <xsl:when test="self::text()">
7044
+ <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))"/>
7045
+ <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
7046
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
7047
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
7048
+ <xsl:with-param name="text" select="$text_dots_"/>
7049
+ </xsl:call-template></text></xsl:variable>
7050
+ <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
7051
+ </xsl:when>
7052
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
7053
+ </xsl:choose>
7054
+ </xsl:for-each>
7055
+ </xsl:when>
7056
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
7057
+ </xsl:choose>
7058
+
7059
+ </xsl:template><xsl:template name="replace_text_tags">
7060
+ <xsl:param name="tag_open"/>
7061
+ <xsl:param name="tag_close"/>
7062
+ <xsl:param name="text"/>
7063
+ <xsl:choose>
7064
+ <xsl:when test="contains($text, $tag_open)">
7065
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
7066
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
7067
+
7068
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
7069
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
7070
+ </xsl:element>
7071
+
7072
+ <xsl:call-template name="replace_text_tags">
7073
+ <xsl:with-param name="tag_open" select="$tag_open"/>
7074
+ <xsl:with-param name="tag_close" select="$tag_close"/>
7075
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
7076
+ </xsl:call-template>
7077
+ </xsl:when>
7078
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
7079
+ </xsl:choose>
7080
+ </xsl:template><xsl:template name="printEdition">
7081
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
7082
+ <xsl:text> </xsl:text>
7083
+ <xsl:choose>
7084
+ <xsl:when test="$edition_i18n != ''">
7085
+ <!-- Example: <edition language="fr">deuxième édition</edition> -->
7086
+ <xsl:call-template name="capitalize">
7087
+ <xsl:with-param name="str" select="$edition_i18n"/>
7088
+ </xsl:call-template>
7089
+ </xsl:when>
7090
+ <xsl:otherwise>
7091
+ <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
7092
+ <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
7093
+ <xsl:call-template name="capitalize">
7094
+ <xsl:with-param name="str">
7095
+ <xsl:call-template name="getLocalizedString">
7096
+ <xsl:with-param name="key">edition</xsl:with-param>
7097
+ </xsl:call-template>
7098
+ </xsl:with-param>
7099
+ </xsl:call-template>
7100
+ <xsl:text> </xsl:text>
7101
+ <xsl:value-of select="$edition"/>
7102
+ </xsl:if>
7103
+ </xsl:otherwise>
7104
+ </xsl:choose>
6812
7105
  </xsl:template><xsl:template name="convertDate">
6813
7106
  <xsl:param name="date"/>
6814
7107
  <xsl:param name="format" select="'short'"/>
@@ -73,6 +73,8 @@
73
73
  </div>
74
74
  {% endif %}
75
75
 
76
+ <div class="coverpage-warning" id="coverpage-note-destination"/>
77
+
76
78
  <div class="copyright">
77
79
  <div class="year">
78
80
  <div id="boilerplate-copyright-destination"/>
@@ -55,6 +55,11 @@ margin-left:4.25pt;margin-right:4.25pt'>
55
55
  </div>
56
56
  {% endif %}
57
57
 
58
+ <div style='mso-element:para-border-div;border:solid windowtext 1.0pt;
59
+ mso-border-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 1.0pt 4.0pt;
60
+ margin-left:4.25pt;margin-right:4.25pt' class="coverpage-warning" id="coverpage-note-destination"/>
61
+
62
+
58
63
  <div align="center" style='text-align:center'>
59
64
  <div id="boilerplate-copyright-destination"/>
60
65
  </div>
@@ -10,13 +10,13 @@ module IsoDoc
10
10
  @meta = Metadata.new(lang, script, i18n)
11
11
  end
12
12
 
13
- def xref_init(lang, script, klass, i18n, options)
13
+ def xref_init(lang, script, _klass, i18n, options)
14
14
  html = HtmlConvert.new(language: lang, script: script)
15
15
  @xrefs = Xref.new(lang, script, html, i18n, options)
16
16
  end
17
17
 
18
18
  def i18n_init(lang, script, i18nyaml = nil)
19
- @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
19
+ @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
20
20
  end
21
21
  end
22
22
  end
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="admonition">
36
+ <element name="admonition">
37
+ <attribute name="type">
38
+ <ref name="AdmonitionType"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="class"/>
42
+ </optional>
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <attribute name="uri">
48
+ <data type="anyURI"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <zeroOrMore>
65
+ <ref name="paragraph-with-footnote"/>
66
+ </zeroOrMore>
67
+ <zeroOrMore>
68
+ <ref name="note"/>
69
+ </zeroOrMore>
70
+ </element>
71
+ </define>
35
72
  <define name="index">
36
73
  <element name="index">
37
74
  <optional>
@@ -851,6 +888,16 @@
851
888
  <ref name="MultilingualRenderingType"/>
852
889
  </attribute>
853
890
  </optional>
891
+ <optional>
892
+ <attribute name="coverpage">
893
+ <data type="boolean"/>
894
+ </attribute>
895
+ </optional>
896
+ <optional>
897
+ <attribute name="notag">
898
+ <data type="boolean"/>
899
+ </attribute>
900
+ </optional>
854
901
  <oneOrMore>
855
902
  <choice>
856
903
  <ref name="paragraph"/>
@@ -1178,6 +1225,7 @@
1178
1225
  <ref name="concept"/>
1179
1226
  <ref name="add"/>
1180
1227
  <ref name="del"/>
1228
+ <ref name="span"/>
1181
1229
  </choice>
1182
1230
  </define>
1183
1231
  <define name="add">
@@ -1204,6 +1252,14 @@
1204
1252
  </choice>
1205
1253
  </element>
1206
1254
  </define>
1255
+ <define name="span">
1256
+ <element name="span">
1257
+ <attribute name="class"/>
1258
+ <oneOrMore>
1259
+ <ref name="TextElement"/>
1260
+ </oneOrMore>
1261
+ </element>
1262
+ </define>
1207
1263
  <define name="concept">
1208
1264
  <element name="concept">
1209
1265
  <optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.0.8".freeze
3
+ VERSION = "2.1.0".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
- spec.add_dependency "metanorma-generic", "~> 2.0.0"
31
+ spec.add_dependency "metanorma-generic", "~> 2.1.0"
32
32
 
33
33
  spec.add_development_dependency "debug"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: 2.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement