metanorma-bipm 2.1.11 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -87,9 +87,9 @@ module IsoDoc
87
87
  def list_people(xml, xpath)
88
88
  ret = []
89
89
  xml.xpath(ns(xpath)).each do |p|
90
- name = p&.at(ns("./name/completename"))&.text
91
- aff = p&.at(ns("./affiliation/organization/abbreviation"))&.text ||
92
- p&.at(ns("./affiliation/organization/name"))&.text
90
+ name = p.at(ns("./name/completename"))&.text
91
+ aff = p.at(ns("./affiliation/organization/abbreviation"))&.text ||
92
+ p.at(ns("./affiliation/organization/name"))&.text
93
93
  c = name || ""
94
94
  aff and c += " (#{aff})"
95
95
  ret << c
@@ -266,6 +266,12 @@ main {
266
266
  padding-left: 30px; }
267
267
  #toc .h3, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h3 {
268
268
  padding-left: 50px; }
269
+ #toc .h4, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h4 {
270
+ padding-left: 70px; }
271
+ #toc .h5, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h5 {
272
+ padding-left: 90px; }
273
+ #toc .h6, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h6 {
274
+ padding-left: 110px; }
269
275
  #toc .toc-active, #toc li:hover, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .toc-active, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) li:hover {
270
276
  background: #6C734A;
271
277
  box-shadow: inset -5px 0px 10px -5px #6C734A !important; }
@@ -1686,6 +1686,8 @@
1686
1686
  </fo:block-container>
1687
1687
  </xsl:template>
1688
1688
 
1689
+ <xsl:strip-space elements="jcgm:xref"/>
1690
+
1689
1691
  <!-- external parameters -->
1690
1692
 
1691
1693
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -2100,6 +2102,14 @@
2100
2102
 
2101
2103
  </xsl:attribute-set>
2102
2104
 
2105
+ <xsl:attribute-set name="pre-style">
2106
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2107
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2108
+
2109
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2110
+
2111
+ </xsl:attribute-set>
2112
+
2103
2113
  <xsl:attribute-set name="permission-style">
2104
2114
 
2105
2115
  </xsl:attribute-set>
@@ -2210,6 +2220,11 @@
2210
2220
  </xsl:variable>
2211
2221
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
2212
2222
 
2223
+ <xsl:variable name="table-cell-border_">
2224
+
2225
+ </xsl:variable>
2226
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
2227
+
2213
2228
  <xsl:attribute-set name="table-container-style">
2214
2229
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2215
2230
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2223,8 +2238,6 @@
2223
2238
  <xsl:attribute-set name="table-style">
2224
2239
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2225
2240
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
2226
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2227
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2228
2241
 
2229
2242
  <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
2230
2243
 
@@ -3089,17 +3102,22 @@
3089
3102
  </xsl:for-each>
3090
3103
  </xsl:template>
3091
3104
 
3105
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3092
3106
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3093
3107
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
3094
3108
  <xsl:template match="text()" name="text">
3095
3109
 
3096
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3097
- <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))"/>
3098
- <xsl:call-template name="replace_fo_inline_tags">
3099
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3100
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3101
- <xsl:with-param name="text" select="$text"/>
3102
- </xsl:call-template>
3110
+ <xsl:choose>
3111
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
3112
+ <xsl:otherwise>
3113
+ <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))"/>
3114
+ <xsl:call-template name="replace_fo_inline_tags">
3115
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
3116
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
3117
+ <xsl:with-param name="text" select="$text"/>
3118
+ </xsl:call-template>
3119
+ </xsl:otherwise>
3120
+ </xsl:choose>
3103
3121
 
3104
3122
  </xsl:template>
3105
3123
 
@@ -3351,6 +3369,12 @@
3351
3369
  <xsl:variable name="table_attributes">
3352
3370
 
3353
3371
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
3372
+
3373
+ <xsl:if test="$margin-side != 0">
3374
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3375
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3376
+ </xsl:if>
3377
+
3354
3378
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3355
3379
 
3356
3380
  <xsl:if test="*[local-name()='thead']">
@@ -3458,7 +3482,7 @@
3458
3482
 
3459
3483
  <!-- centered table when table name is centered (see table-name-style) -->
3460
3484
 
3461
- <fo:table table-layout="fixed" width="100%">
3485
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
3462
3486
  <fo:table-column column-width="proportional-column-width(1)"/>
3463
3487
  <fo:table-column column-width="{@width}"/>
3464
3488
  <fo:table-column column-width="proportional-column-width(1)"/>
@@ -3509,7 +3533,7 @@
3509
3533
 
3510
3534
  <xsl:choose>
3511
3535
  <xsl:when test="$continued = 'true'">
3512
-
3536
+ <!-- $namespace = 'iso' or -->
3513
3537
  <xsl:apply-templates/>
3514
3538
 
3515
3539
  </xsl:when>
@@ -4178,6 +4202,10 @@
4178
4202
  <xsl:template match="*[local-name()='tr']">
4179
4203
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
4180
4204
 
4205
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
4206
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4207
+ </xsl:if>
4208
+
4181
4209
  <xsl:call-template name="setTableRowAttributes"/>
4182
4210
  <xsl:apply-templates/>
4183
4211
  </fo:table-row>
@@ -5159,7 +5187,8 @@
5159
5187
  <xsl:copy-of select="node()"/>
5160
5188
  </td>
5161
5189
  <td>
5162
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
5190
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
5191
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
5163
5192
  <!-- get paragraphs from nested 'dl' -->
5164
5193
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
5165
5194
  </td>
@@ -5167,6 +5196,53 @@
5167
5196
  </xsl:template>
5168
5197
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
5169
5198
 
5199
+ <xsl:template match="*" mode="dl_if">
5200
+ <xsl:copy-of select="."/>
5201
+ </xsl:template>
5202
+
5203
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
5204
+ <xsl:param name="indent"/>
5205
+ <p>
5206
+ <xsl:copy-of select="@*"/>
5207
+ <xsl:value-of select="$indent"/>
5208
+ <xsl:copy-of select="node()"/>
5209
+ </p>
5210
+
5211
+ </xsl:template>
5212
+
5213
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
5214
+ <xsl:variable name="list_rendered_">
5215
+ <xsl:apply-templates select="."/>
5216
+ </xsl:variable>
5217
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
5218
+
5219
+ <xsl:variable name="indent">
5220
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
5221
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
5222
+ </xsl:for-each>
5223
+ </xsl:variable>
5224
+
5225
+ <xsl:apply-templates mode="dl_if">
5226
+ <xsl:with-param name="indent" select="$indent"/>
5227
+ </xsl:apply-templates>
5228
+ </xsl:template>
5229
+
5230
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
5231
+ <xsl:param name="indent"/>
5232
+ <xsl:apply-templates mode="dl_if">
5233
+ <xsl:with-param name="indent" select="$indent"/>
5234
+ </xsl:apply-templates>
5235
+ </xsl:template>
5236
+
5237
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
5238
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
5239
+ <!-- emulate left indent for list item -->
5240
+ <xsl:call-template name="repeat">
5241
+ <xsl:with-param name="char" select="'x'"/>
5242
+ <xsl:with-param name="count" select="$value"/>
5243
+ </xsl:call-template>
5244
+ </xsl:template>
5245
+
5170
5246
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
5171
5247
  <xsl:for-each select="*[local-name() = 'dt']">
5172
5248
  <p>
@@ -5563,6 +5639,7 @@
5563
5639
  </word>
5564
5640
  <xsl:call-template name="tokenize_with_tags">
5565
5641
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
5642
+ <xsl:with-param name="tags" select="$tags"/>
5566
5643
  </xsl:call-template>
5567
5644
  </xsl:otherwise>
5568
5645
  </xsl:choose>
@@ -5602,8 +5679,18 @@
5602
5679
 
5603
5680
  <xsl:template name="add-zero-spaces-java">
5604
5681
  <xsl:param name="text" select="."/>
5605
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5606
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
5682
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
5683
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
5684
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
5685
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
5686
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
5687
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
5688
+ <!-- add zero-width space (#x200B) before character: { -->
5689
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
5690
+ <!-- add zero-width space (#x200B) after character: , -->
5691
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
5692
+
5693
+ <xsl:value-of select="$text5"/>
5607
5694
  </xsl:template>
5608
5695
 
5609
5696
  <xsl:template name="add-zero-spaces-link-java">
@@ -5749,7 +5836,7 @@
5749
5836
  </xsl:copy>
5750
5837
  </xsl:template>
5751
5838
 
5752
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
5839
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
5753
5840
  <xsl:copy>
5754
5841
  <xsl:copy-of select="@*"/>
5755
5842
  <p>
@@ -5797,6 +5884,28 @@
5797
5884
  </xsl:for-each>
5798
5885
  </xsl:template>
5799
5886
 
5887
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
5888
+ <xsl:apply-templates mode="table-without-br"/>
5889
+ </xsl:template>
5890
+
5891
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
5892
+
5893
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
5894
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
5895
+ <xsl:variable name="items">
5896
+ <xsl:call-template name="split">
5897
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
5898
+ <xsl:with-param name="sep" select="$sep"/>
5899
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
5900
+ </xsl:call-template>
5901
+ </xsl:variable>
5902
+ <xsl:for-each select="xalan:nodeset($items)/*">
5903
+ <p>
5904
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
5905
+ </p>
5906
+ </xsl:for-each>
5907
+ </xsl:template>
5908
+
5800
5909
  <!-- remove redundant white spaces -->
5801
5910
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
5802
5911
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -6107,6 +6216,7 @@
6107
6216
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
6108
6217
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
6109
6218
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6219
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
6110
6220
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6111
6221
  </tags>
6112
6222
  </xsl:template>
@@ -6169,6 +6279,9 @@
6169
6279
  <xsl:value-of select="substring($str, 2)"/>
6170
6280
  </xsl:template>
6171
6281
 
6282
+ <!-- ======================================= -->
6283
+ <!-- math -->
6284
+ <!-- ======================================= -->
6172
6285
  <xsl:template match="mathml:math">
6173
6286
  <xsl:variable name="isAdded" select="@added"/>
6174
6287
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -6219,14 +6332,57 @@
6219
6332
  <xsl:value-of select="$comment_text"/>
6220
6333
  </xsl:template>
6221
6334
 
6335
+ <xsl:template match="*[local-name() = 'asciimath']">
6336
+ <xsl:param name="process" select="'false'"/>
6337
+ <xsl:if test="$process = 'true'">
6338
+ <xsl:apply-templates/>
6339
+ </xsl:if>
6340
+ </xsl:template>
6341
+
6342
+ <xsl:template match="*[local-name() = 'latexmath']"/>
6343
+
6344
+ <xsl:template name="getMathml_asciimath_text">
6345
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
6346
+ <xsl:variable name="latexmath">
6347
+
6348
+ </xsl:variable>
6349
+ <xsl:variable name="asciimath_text_following">
6350
+ <xsl:choose>
6351
+ <xsl:when test="normalize-space($latexmath) != ''">
6352
+ <xsl:value-of select="$latexmath"/>
6353
+ </xsl:when>
6354
+ <xsl:when test="normalize-space($asciimath) != ''">
6355
+ <xsl:value-of select="$asciimath"/>
6356
+ </xsl:when>
6357
+ <xsl:otherwise>
6358
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
6359
+ </xsl:otherwise>
6360
+ </xsl:choose>
6361
+ </xsl:variable>
6362
+ <xsl:variable name="asciimath_text_">
6363
+ <xsl:choose>
6364
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
6365
+ <xsl:value-of select="$asciimath_text_following"/>
6366
+ </xsl:when>
6367
+ <xsl:otherwise>
6368
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
6369
+ </xsl:otherwise>
6370
+ </xsl:choose>
6371
+ </xsl:variable>
6372
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
6373
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
6374
+ <xsl:value-of select="$asciimath_text"/>
6375
+ </xsl:template>
6376
+
6222
6377
  <xsl:template name="mathml_instream_object">
6223
- <xsl:param name="comment_text"/>
6378
+ <xsl:param name="asciimath_text"/>
6224
6379
  <xsl:param name="mathml_content"/>
6225
6380
 
6226
- <xsl:variable name="comment_text_">
6381
+ <xsl:variable name="asciimath_text_">
6227
6382
  <xsl:choose>
6228
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
6229
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
6383
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
6384
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
6385
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
6230
6386
  </xsl:choose>
6231
6387
  </xsl:variable>
6232
6388
 
@@ -6250,10 +6406,10 @@
6250
6406
  </xsl:attribute>
6251
6407
 
6252
6408
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6253
- <xsl:if test="normalize-space($comment_text_) != ''">
6409
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
6254
6410
  <!-- put Mathin Alternate Text -->
6255
6411
  <xsl:attribute name="fox:alt-text">
6256
- <xsl:value-of select="$comment_text_"/>
6412
+ <xsl:value-of select="$asciimath_text_"/>
6257
6413
  </xsl:attribute>
6258
6414
  </xsl:if>
6259
6415
  <!-- </xsl:if> -->
@@ -6326,6 +6482,29 @@
6326
6482
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6327
6483
  </xsl:template>
6328
6484
 
6485
+ <!-- Examples:
6486
+ <stem type="AsciiMath">x = 1</stem>
6487
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
6488
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
6489
+ -->
6490
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6491
+ <fo:inline xsl:use-attribute-sets="mathml-style">
6492
+
6493
+ <xsl:choose>
6494
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6495
+ <xsl:otherwise>
6496
+ <xsl:apply-templates>
6497
+ <xsl:with-param name="process">true</xsl:with-param>
6498
+ </xsl:apply-templates>
6499
+ </xsl:otherwise>
6500
+ </xsl:choose>
6501
+
6502
+ </fo:inline>
6503
+ </xsl:template>
6504
+ <!-- ======================================= -->
6505
+ <!-- END: math -->
6506
+ <!-- ======================================= -->
6507
+
6329
6508
  <xsl:template match="*[local-name()='localityStack']"/>
6330
6509
 
6331
6510
  <xsl:template match="*[local-name()='link']" name="link">
@@ -6528,6 +6707,12 @@
6528
6707
 
6529
6708
  <fo:block-container margin-left="0mm">
6530
6709
 
6710
+ <!-- <xsl:if test="$namespace = 'iho'">
6711
+ <xsl:if test="ancestor::iho:td">
6712
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
6713
+ </xsl:if>
6714
+ </xsl:if> -->
6715
+
6531
6716
  <fo:block>
6532
6717
 
6533
6718
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -7664,43 +7849,21 @@
7664
7849
  <xsl:apply-templates mode="contents_item"/>
7665
7850
  </xsl:template>
7666
7851
 
7667
- <!-- ====== -->
7668
- <!-- sourcecode -->
7669
- <!-- ====== -->
7852
+ <!-- =============== -->
7853
+ <!-- sourcecode -->
7854
+ <!-- =============== -->
7670
7855
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7671
7856
 
7672
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
7673
-
7674
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
7675
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
7676
- </xsl:if>
7677
-
7678
- <xsl:if test="ancestor::*[local-name() = 'example']">
7679
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
7680
- </xsl:if>
7681
-
7682
- <xsl:copy-of select="@id"/>
7683
-
7684
- <xsl:if test="parent::*[local-name() = 'note']">
7685
- <xsl:attribute name="margin-left">
7686
- <xsl:choose>
7687
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
7688
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
7689
- </xsl:choose>
7690
- </xsl:attribute>
7691
-
7692
- </xsl:if>
7693
- <fo:block-container margin-left="0mm">
7694
-
7695
- <fo:block xsl:use-attribute-sets="sourcecode-style">
7696
- <xsl:variable name="_font-size">
7857
+ <xsl:variable name="sourcecode_attributes">
7858
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7859
+ <xsl:variable name="_font-size">
7697
7860
 
7698
- <!-- 9 -->
7861
+ <!-- 9 -->
7699
7862
 
7700
- 9
7701
- <!-- <xsl:if test="$namespace = 'ieee'">
7702
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7703
- </xsl:if> -->
7863
+ 9
7864
+ <!-- <xsl:if test="$namespace = 'ieee'">
7865
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7866
+ </xsl:if> -->
7704
7867
 
7705
7868
  </xsl:variable>
7706
7869
 
@@ -7715,14 +7878,60 @@
7715
7878
  </xsl:choose>
7716
7879
  </xsl:attribute>
7717
7880
  </xsl:if>
7881
+ </xsl:element>
7882
+ </xsl:variable>
7718
7883
 
7884
+ <xsl:choose>
7885
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7886
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
7887
+ <xsl:attribute name="{local-name()}">
7888
+ <xsl:value-of select="."/>
7889
+ </xsl:attribute>
7890
+ </xsl:for-each>
7719
7891
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7720
- </fo:block>
7892
+ </xsl:when>
7721
7893
 
7722
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7894
+ <xsl:otherwise>
7895
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
7723
7896
 
7724
- </fo:block-container>
7725
- </fo:block-container>
7897
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
7898
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
7899
+ </xsl:if>
7900
+
7901
+ <xsl:if test="ancestor::*[local-name() = 'example']">
7902
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
7903
+ </xsl:if>
7904
+
7905
+ <xsl:copy-of select="@id"/>
7906
+
7907
+ <xsl:if test="parent::*[local-name() = 'note']">
7908
+ <xsl:attribute name="margin-left">
7909
+ <xsl:choose>
7910
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
7911
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
7912
+ </xsl:choose>
7913
+ </xsl:attribute>
7914
+
7915
+ </xsl:if>
7916
+ <fo:block-container margin-left="0mm">
7917
+
7918
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
7919
+
7920
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
7921
+ <xsl:attribute name="{local-name()}">
7922
+ <xsl:value-of select="."/>
7923
+ </xsl:attribute>
7924
+ </xsl:for-each>
7925
+
7926
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7927
+ </fo:block>
7928
+
7929
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7930
+
7931
+ </fo:block-container>
7932
+ </fo:block-container>
7933
+ </xsl:otherwise>
7934
+ </xsl:choose>
7726
7935
  </xsl:template>
7727
7936
 
7728
7937
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -7964,8 +8173,22 @@
7964
8173
  </fo:block>
7965
8174
  </xsl:if>
7966
8175
  </xsl:template>
7967
- <!-- ====== -->
7968
- <!-- ====== -->
8176
+ <!-- =============== -->
8177
+ <!-- END sourcecode -->
8178
+ <!-- =============== -->
8179
+
8180
+ <!-- =============== -->
8181
+ <!-- pre -->
8182
+ <!-- =============== -->
8183
+ <xsl:template match="*[local-name()='pre']" name="pre">
8184
+ <fo:block xsl:use-attribute-sets="pre-style">
8185
+ <xsl:copy-of select="@id"/>
8186
+ <xsl:apply-templates/>
8187
+ </fo:block>
8188
+ </xsl:template>
8189
+ <!-- =============== -->
8190
+ <!-- pre -->
8191
+ <!-- =============== -->
7969
8192
 
7970
8193
  <!-- ========== -->
7971
8194
  <!-- permission -->
@@ -9939,7 +10162,9 @@
9939
10162
  <!-- ===================================== -->
9940
10163
  <!-- Update xml -->
9941
10164
  <!-- ===================================== -->
10165
+ <!-- =========================================================================== -->
9942
10166
  <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10167
+ <!-- =========================================================================== -->
9943
10168
  <xsl:template match="@*|node()" mode="update_xml_step1">
9944
10169
  <xsl:copy>
9945
10170
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -10031,10 +10256,15 @@
10031
10256
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10032
10257
  <xsl:apply-templates mode="update_xml_step1"/>
10033
10258
  </xsl:template>
10034
-
10259
+ <!-- =========================================================================== -->
10035
10260
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10261
+ <!-- =========================================================================== -->
10036
10262
 
10263
+ <!-- =========================================================================== -->
10037
10264
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10265
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10266
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
10267
+ <!-- =========================================================================== -->
10038
10268
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
10039
10269
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
10040
10270
  <xsl:copy>
@@ -10050,10 +10280,15 @@
10050
10280
  <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
10051
10281
 
10052
10282
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
10053
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
10054
10283
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10055
10284
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
10056
- <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))"/>
10285
+ <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))"/>
10286
+ <xsl:variable name="text_">
10287
+ <xsl:choose>
10288
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
10289
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
10290
+ </xsl:choose>
10291
+ </xsl:variable>
10057
10292
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
10058
10293
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
10059
10294
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -10069,7 +10304,11 @@
10069
10304
  </xsl:variable>
10070
10305
 
10071
10306
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
10072
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
10307
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
10308
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
10309
+ <!-- add &lt; and &gt; to \S -->
10310
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
10311
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
10073
10312
  <xsl:variable name="text3">
10074
10313
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
10075
10314
  <xsl:choose>
@@ -10133,9 +10372,8 @@
10133
10372
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
10134
10373
  </xsl:choose>
10135
10374
  </xsl:template>
10136
-
10137
10375
  <!-- ===================================== -->
10138
- <!-- End Update xml -->
10376
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10139
10377
  <!-- ===================================== -->
10140
10378
 
10141
10379
  <!-- for correct rendering combining chars -->
@@ -10520,13 +10758,14 @@
10520
10758
  </xsl:template>
10521
10759
 
10522
10760
  <xsl:template name="setId">
10761
+ <xsl:param name="prefix"/>
10523
10762
  <xsl:attribute name="id">
10524
10763
  <xsl:choose>
10525
10764
  <xsl:when test="@id">
10526
- <xsl:value-of select="@id"/>
10765
+ <xsl:value-of select="concat($prefix, @id)"/>
10527
10766
  </xsl:when>
10528
10767
  <xsl:otherwise>
10529
- <xsl:value-of select="generate-id()"/>
10768
+ <xsl:value-of select="concat($prefix, generate-id())"/>
10530
10769
  </xsl:otherwise>
10531
10770
  </xsl:choose>
10532
10771
  </xsl:attribute>
@@ -188,6 +188,11 @@
188
188
  <value>adapter</value>
189
189
  <value>translator</value>
190
190
  <value>distributor</value>
191
+ <value>realizer</value>
192
+ <value>owner</value>
193
+ <value>authorizer</value>
194
+ <value>enabler</value>
195
+ <value>subject</value>
191
196
  </choice>
192
197
  </attribute>
193
198
  <zeroOrMore>