metanorma-bipm 2.1.12 → 2.2.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: 9646a056278cd68248390dedde7d635cf80d4b6617fc8d5d50ddce0654a3e4e1
4
- data.tar.gz: 3a58fd80e587e34342b9f95944f05ce38da2ef28fdeab15b9ec41d2e7d469c98
3
+ metadata.gz: 5473d53c218ef9be08f8d8664f388c27684eca2af7bc86e4c501d9d922d50f64
4
+ data.tar.gz: 0dd3d6d95f9e7975e3f76e00c9b486b5c97a753ce45cd1af450b82cf80ddad5b
5
5
  SHA512:
6
- metadata.gz: bd897f8bdd06512637106113cc6f1d45a836bd9f3d18964a50187e03c6a7b6d8b17271945f26ae5dde87e410a77e244ac79de8cb121bf6bb7a93bb303226e8ed
7
- data.tar.gz: 5dee365292ec477ebbb3d97e0eacd27fdeb1ce0999496ba999f8c336c5171e5e9d867baef20c03995339f3f2b8a4d17ba61c7c4b8c18c0288f3e5d18dfa436b7
6
+ metadata.gz: 8e9aeb4d4752a121f6dc00049988937cf6eadb7e3833e5df79d574dcb74fa1bbeff911a33e70f63bcc880cf1cf50f8f3eaf1b3099b494b78f7db299c1a71ade1
7
+ data.tar.gz: 54655f2d26b574f6e8231cf945505905d733ab08512e109f9e10fa1d96622f0bf8e581099ac8d08fab8d8ddca5dca66740d95603a6b10aa1153a59d4339d3a2a
@@ -3798,6 +3798,8 @@
3798
3798
  </xsl:if>
3799
3799
  </xsl:template>
3800
3800
 
3801
+ <xsl:strip-space elements="bipm:xref"/>
3802
+
3801
3803
  <!-- external parameters -->
3802
3804
 
3803
3805
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -5193,17 +5195,22 @@
5193
5195
  </xsl:for-each>
5194
5196
  </xsl:template>
5195
5197
 
5198
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5196
5199
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
5197
5200
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
5198
5201
  <xsl:template match="text()" name="text">
5199
5202
 
5200
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5201
- <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))"/>
5202
- <xsl:call-template name="replace_fo_inline_tags">
5203
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
5204
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
5205
- <xsl:with-param name="text" select="$text"/>
5206
- </xsl:call-template>
5203
+ <xsl:choose>
5204
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
5205
+ <xsl:otherwise>
5206
+ <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))"/>
5207
+ <xsl:call-template name="replace_fo_inline_tags">
5208
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
5209
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
5210
+ <xsl:with-param name="text" select="$text"/>
5211
+ </xsl:call-template>
5212
+ </xsl:otherwise>
5213
+ </xsl:choose>
5207
5214
 
5208
5215
  </xsl:template>
5209
5216
 
@@ -6272,7 +6279,7 @@
6272
6279
  <xsl:template match="*[local-name()='tr']">
6273
6280
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6274
6281
 
6275
- <xsl:if test="*[local-name() = 'th']">
6282
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
6276
6283
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6277
6284
  </xsl:if>
6278
6285
 
@@ -6485,6 +6492,10 @@
6485
6492
  <xsl:variable name="footnote_inline">
6486
6493
  <fo:inline xsl:use-attribute-sets="fn-num-style">
6487
6494
 
6495
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
6496
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6497
+ </xsl:if>
6498
+
6488
6499
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6489
6500
  <xsl:value-of select="$current_fn_number_text"/>
6490
6501
  </fo:basic-link>
@@ -7291,7 +7302,8 @@
7291
7302
  <xsl:copy-of select="node()"/>
7292
7303
  </td>
7293
7304
  <td>
7294
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7305
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
7306
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
7295
7307
  <!-- get paragraphs from nested 'dl' -->
7296
7308
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7297
7309
  </td>
@@ -7299,6 +7311,53 @@
7299
7311
  </xsl:template>
7300
7312
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
7301
7313
 
7314
+ <xsl:template match="*" mode="dl_if">
7315
+ <xsl:copy-of select="."/>
7316
+ </xsl:template>
7317
+
7318
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
7319
+ <xsl:param name="indent"/>
7320
+ <p>
7321
+ <xsl:copy-of select="@*"/>
7322
+ <xsl:value-of select="$indent"/>
7323
+ <xsl:copy-of select="node()"/>
7324
+ </p>
7325
+
7326
+ </xsl:template>
7327
+
7328
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
7329
+ <xsl:variable name="list_rendered_">
7330
+ <xsl:apply-templates select="."/>
7331
+ </xsl:variable>
7332
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
7333
+
7334
+ <xsl:variable name="indent">
7335
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
7336
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
7337
+ </xsl:for-each>
7338
+ </xsl:variable>
7339
+
7340
+ <xsl:apply-templates mode="dl_if">
7341
+ <xsl:with-param name="indent" select="$indent"/>
7342
+ </xsl:apply-templates>
7343
+ </xsl:template>
7344
+
7345
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
7346
+ <xsl:param name="indent"/>
7347
+ <xsl:apply-templates mode="dl_if">
7348
+ <xsl:with-param name="indent" select="$indent"/>
7349
+ </xsl:apply-templates>
7350
+ </xsl:template>
7351
+
7352
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
7353
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
7354
+ <!-- emulate left indent for list item -->
7355
+ <xsl:call-template name="repeat">
7356
+ <xsl:with-param name="char" select="'x'"/>
7357
+ <xsl:with-param name="count" select="$value"/>
7358
+ </xsl:call-template>
7359
+ </xsl:template>
7360
+
7302
7361
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
7303
7362
  <xsl:for-each select="*[local-name() = 'dt']">
7304
7363
  <p>
@@ -7594,6 +7653,23 @@
7594
7653
  <xsl:apply-templates/>
7595
7654
  </xsl:template>
7596
7655
 
7656
+ <!-- Don't break standard's numbers -->
7657
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
7658
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
7659
+ <xsl:choose>
7660
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
7661
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
7662
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7663
+ </xsl:when>
7664
+ <xsl:otherwise>
7665
+ <xsl:apply-templates/>
7666
+ </xsl:otherwise>
7667
+ </xsl:choose>
7668
+ </xsl:template>
7669
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
7670
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7671
+ </xsl:template>
7672
+
7597
7673
  <!-- ========================= -->
7598
7674
  <!-- END Rich text formatting -->
7599
7675
  <!-- ========================= -->
@@ -7692,6 +7768,7 @@
7692
7768
  </word>
7693
7769
  <xsl:call-template name="tokenize_with_tags">
7694
7770
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
7771
+ <xsl:with-param name="tags" select="$tags"/>
7695
7772
  </xsl:call-template>
7696
7773
  </xsl:otherwise>
7697
7774
  </xsl:choose>
@@ -7731,8 +7808,18 @@
7731
7808
 
7732
7809
  <xsl:template name="add-zero-spaces-java">
7733
7810
  <xsl:param name="text" select="."/>
7734
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7735
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
7811
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
7812
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
7813
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
7814
+ <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' -->
7815
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
7816
+ <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' -->
7817
+ <!-- add zero-width space (#x200B) before character: { -->
7818
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7819
+ <!-- add zero-width space (#x200B) after character: , -->
7820
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7821
+
7822
+ <xsl:value-of select="$text5"/>
7736
7823
  </xsl:template>
7737
7824
 
7738
7825
  <xsl:template name="add-zero-spaces-link-java">
@@ -7878,7 +7965,7 @@
7878
7965
  </xsl:copy>
7879
7966
  </xsl:template>
7880
7967
 
7881
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
7968
+ <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">
7882
7969
  <xsl:copy>
7883
7970
  <xsl:copy-of select="@*"/>
7884
7971
  <p>
@@ -7926,6 +8013,28 @@
7926
8013
  </xsl:for-each>
7927
8014
  </xsl:template>
7928
8015
 
8016
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
8017
+ <xsl:apply-templates mode="table-without-br"/>
8018
+ </xsl:template>
8019
+
8020
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
8021
+
8022
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
8023
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
8024
+ <xsl:variable name="items">
8025
+ <xsl:call-template name="split">
8026
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
8027
+ <xsl:with-param name="sep" select="$sep"/>
8028
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
8029
+ </xsl:call-template>
8030
+ </xsl:variable>
8031
+ <xsl:for-each select="xalan:nodeset($items)/*">
8032
+ <p>
8033
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
8034
+ </p>
8035
+ </xsl:for-each>
8036
+ </xsl:template>
8037
+
7929
8038
  <!-- remove redundant white spaces -->
7930
8039
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
7931
8040
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -7956,7 +8065,7 @@
7956
8065
  <xsl:choose>
7957
8066
  <xsl:when test="@colspan">
7958
8067
  <xsl:variable name="td">
7959
- <xsl:element name="td">
8068
+ <xsl:element name="{local-name()}">
7960
8069
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
7961
8070
  <xsl:if test="local-name()='th'">
7962
8071
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -7971,7 +8080,7 @@
7971
8080
  </xsl:call-template>
7972
8081
  </xsl:when>
7973
8082
  <xsl:otherwise>
7974
- <xsl:element name="td">
8083
+ <xsl:element name="{local-name()}">
7975
8084
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
7976
8085
  <xsl:if test="local-name()='th'">
7977
8086
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -8038,7 +8147,7 @@
8038
8147
  <xsl:variable name="currentRow" select="."/>
8039
8148
 
8040
8149
  <xsl:variable name="normalizedTDs">
8041
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
8150
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
8042
8151
  <xsl:choose>
8043
8152
  <xsl:when test="@rowspan &gt; 1">
8044
8153
  <xsl:copy>
@@ -8050,7 +8159,7 @@
8050
8159
  </xsl:copy>
8051
8160
  </xsl:when>
8052
8161
  <xsl:otherwise>
8053
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
8162
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
8054
8163
  </xsl:otherwise>
8055
8164
  </xsl:choose>
8056
8165
  </xsl:for-each>
@@ -8236,6 +8345,7 @@
8236
8345
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
8237
8346
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
8238
8347
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
8348
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
8239
8349
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
8240
8350
  </tags>
8241
8351
  </xsl:template>
@@ -9290,6 +9400,31 @@
9290
9400
  <xsl:apply-templates mode="svg_update"/>
9291
9401
  </xsl:copy>
9292
9402
  </xsl:template>
9403
+
9404
+ <!-- regex for 'display: inline-block;' -->
9405
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
9406
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
9407
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
9408
+ </xsl:template>
9409
+
9410
+ <!-- replace
9411
+ stroke="rgba(r, g, b, alpha)" to
9412
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
9413
+ fill="rgba(r, g, b, alpha)" to
9414
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
9415
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
9416
+ <xsl:variable name="components_">
9417
+ <xsl:call-template name="split">
9418
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
9419
+ <xsl:with-param name="sep" select="','"/>
9420
+ </xsl:call-template>
9421
+ </xsl:variable>
9422
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
9423
+ <xsl:variable name="att_name" select="local-name()"/>
9424
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
9425
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
9426
+ </xsl:template>
9427
+
9293
9428
  <!-- ============== -->
9294
9429
  <!-- END: svg_update -->
9295
9430
  <!-- ============== -->
@@ -9942,37 +10077,15 @@
9942
10077
  <!-- =============== -->
9943
10078
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9944
10079
 
9945
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
9946
-
9947
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
9948
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
9949
- </xsl:if>
9950
-
9951
- <xsl:if test="ancestor::*[local-name() = 'example']">
9952
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
9953
- </xsl:if>
9954
-
9955
- <xsl:copy-of select="@id"/>
9956
-
9957
- <xsl:if test="parent::*[local-name() = 'note']">
9958
- <xsl:attribute name="margin-left">
9959
- <xsl:choose>
9960
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
9961
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
9962
- </xsl:choose>
9963
- </xsl:attribute>
9964
-
9965
- </xsl:if>
9966
- <fo:block-container margin-left="0mm">
10080
+ <xsl:variable name="sourcecode_attributes">
10081
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10082
+ <xsl:variable name="_font-size">
9967
10083
 
9968
- <fo:block xsl:use-attribute-sets="sourcecode-style">
9969
- <xsl:variable name="_font-size">
10084
+ <!-- 9 -->
9970
10085
 
9971
- <!-- 9 -->
9972
-
9973
- <!-- <xsl:if test="$namespace = 'ieee'">
9974
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
9975
- </xsl:if> -->
10086
+ <!-- <xsl:if test="$namespace = 'ieee'">
10087
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
10088
+ </xsl:if> -->
9976
10089
 
9977
10090
  </xsl:variable>
9978
10091
 
@@ -9987,14 +10100,60 @@
9987
10100
  </xsl:choose>
9988
10101
  </xsl:attribute>
9989
10102
  </xsl:if>
10103
+ </xsl:element>
10104
+ </xsl:variable>
9990
10105
 
10106
+ <xsl:choose>
10107
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
10108
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
10109
+ <xsl:attribute name="{local-name()}">
10110
+ <xsl:value-of select="."/>
10111
+ </xsl:attribute>
10112
+ </xsl:for-each>
9991
10113
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9992
- </fo:block>
10114
+ </xsl:when>
9993
10115
 
9994
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
10116
+ <xsl:otherwise>
10117
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
9995
10118
 
9996
- </fo:block-container>
9997
- </fo:block-container>
10119
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
10120
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
10121
+ </xsl:if>
10122
+
10123
+ <xsl:if test="ancestor::*[local-name() = 'example']">
10124
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
10125
+ </xsl:if>
10126
+
10127
+ <xsl:copy-of select="@id"/>
10128
+
10129
+ <xsl:if test="parent::*[local-name() = 'note']">
10130
+ <xsl:attribute name="margin-left">
10131
+ <xsl:choose>
10132
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
10133
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
10134
+ </xsl:choose>
10135
+ </xsl:attribute>
10136
+
10137
+ </xsl:if>
10138
+ <fo:block-container margin-left="0mm">
10139
+
10140
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
10141
+
10142
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
10143
+ <xsl:attribute name="{local-name()}">
10144
+ <xsl:value-of select="."/>
10145
+ </xsl:attribute>
10146
+ </xsl:for-each>
10147
+
10148
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10149
+ </fo:block>
10150
+
10151
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
10152
+
10153
+ </fo:block-container>
10154
+ </fo:block-container>
10155
+ </xsl:otherwise>
10156
+ </xsl:choose>
9998
10157
  </xsl:template>
9999
10158
 
10000
10159
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -12223,7 +12382,11 @@
12223
12382
  <!-- ===================================== -->
12224
12383
  <!-- Update xml -->
12225
12384
  <!-- ===================================== -->
12226
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12385
+ <!-- =========================================================================== -->
12386
+ <!-- STEP1: -->
12387
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
12388
+ <!-- - Ignore 'span' without style -->
12389
+ <!-- =========================================================================== -->
12227
12390
  <xsl:template match="@*|node()" mode="update_xml_step1">
12228
12391
  <xsl:copy>
12229
12392
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -12305,7 +12468,8 @@
12305
12468
  </xsl:copy>
12306
12469
  </xsl:template>
12307
12470
 
12308
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
12471
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12472
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
12309
12473
  <xsl:copy>
12310
12474
  <xsl:copy-of select="@*"/>
12311
12475
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12315,10 +12479,15 @@
12315
12479
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12316
12480
  <xsl:apply-templates mode="update_xml_step1"/>
12317
12481
  </xsl:template>
12318
-
12482
+ <!-- =========================================================================== -->
12319
12483
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12484
+ <!-- =========================================================================== -->
12320
12485
 
12486
+ <!-- =========================================================================== -->
12321
12487
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12488
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12489
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12490
+ <!-- =========================================================================== -->
12322
12491
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
12323
12492
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
12324
12493
  <xsl:copy>
@@ -12334,10 +12503,15 @@
12334
12503
  <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">
12335
12504
 
12336
12505
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12337
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
12338
12506
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12339
12507
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12340
- <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))"/>
12508
+ <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))"/>
12509
+ <xsl:variable name="text_">
12510
+ <xsl:choose>
12511
+ <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 -->
12512
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
12513
+ </xsl:choose>
12514
+ </xsl:variable>
12341
12515
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
12342
12516
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12343
12517
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -12353,7 +12527,11 @@
12353
12527
  </xsl:variable>
12354
12528
 
12355
12529
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12356
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
12530
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12531
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12532
+ <!-- add &lt; and &gt; to \S -->
12533
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
12534
+ <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>
12357
12535
  <xsl:variable name="text3">
12358
12536
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
12359
12537
  <xsl:choose>
@@ -12417,9 +12595,8 @@
12417
12595
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
12418
12596
  </xsl:choose>
12419
12597
  </xsl:template>
12420
-
12421
12598
  <!-- ===================================== -->
12422
- <!-- End Update xml -->
12599
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12423
12600
  <!-- ===================================== -->
12424
12601
 
12425
12602
  <!-- for correct rendering combining chars -->