metanorma-bipm 2.2.4 → 2.2.5

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: 815bfaaa9c62ae13ac3bcea7cc4675bb45ea2ec522bf68cf58fe4807a7a75bc9
4
- data.tar.gz: 7876ea849797ac31c1cf0bab39180642868d2127f9a15eee8e048d1a1690e1f8
3
+ metadata.gz: 68a03fbea0632055a005260138bf287104e49075dcab5806f4b8b02cd853b710
4
+ data.tar.gz: 22c35226290ce61cdeffa8b1c464aa855927835ca3fe48e0393c5d8ff5392976
5
5
  SHA512:
6
- metadata.gz: 9ef5bdc74803f837498cdeef66d439ad8f05e5a25f7c4e82eff8fbf5aa5f803d61426826ee27b521b64422de6f0d7dee1036e4d4f0467c13f97533fb41291ad4
7
- data.tar.gz: 74e66902d70979649a37fe637c85d1cff6fffcd42c3bac84834ff0360cd0d25c46456cd006910f9987ca284cd8193cad7b7ece1314cbcf5a87d9743aa1c899fb
6
+ metadata.gz: 59855251b86849e465ef8448583eacb0222d22460fc8efa7f77d4c1b8347ab093670b1eb4a08fbb51a1af52423f349b6ee02495a600e86d557efd7b3b6623f39
7
+ data.tar.gz: b1868a74516914e10bb865479f91149f0dadf2d99eb44dcd76ed6e829be0b2a05cb2a414d719f5007786126e7a0324e0f5a29d33947260ec8ec41ca5318f8f54
@@ -5522,6 +5522,7 @@
5522
5522
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
5523
5523
 
5524
5524
  <xsl:choose>
5525
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
5525
5526
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
5526
5527
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
5527
5528
  </xsl:choose>
@@ -5643,7 +5644,7 @@
5643
5644
  <xsl:variable name="isDeleted" select="@deleted"/>
5644
5645
 
5645
5646
  <xsl:choose>
5646
- <xsl:when test="@width">
5647
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
5647
5648
 
5648
5649
  <!-- centered table when table name is centered (see table-name-style) -->
5649
5650
 
@@ -5985,6 +5986,7 @@
5985
5986
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
5986
5987
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
5987
5988
  <!-- difference between the available space and the minimum table width -->
5989
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
5988
5990
  <xsl:variable name="W" select="$page_width - @width_min"/>
5989
5991
  <W><xsl:value-of select="$W"/></W>
5990
5992
  <!-- difference between maximum and minimum width of the table -->
@@ -6663,21 +6665,24 @@
6663
6665
  <xsl:for-each select="xalan:nodeset($references)//fn">
6664
6666
  <xsl:variable name="reference" select="@reference"/>
6665
6667
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6666
- <fo:block xsl:use-attribute-sets="table-fn-style">
6667
6668
 
6668
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6669
+ <fo:block xsl:use-attribute-sets="table-fn-style">
6669
6670
 
6670
- <fo:inline font-style="normal">(</fo:inline>
6671
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6671
6672
 
6672
- <xsl:value-of select="@reference"/>
6673
+ <fo:inline font-style="normal">(</fo:inline>
6673
6674
 
6674
- <fo:inline font-style="normal">)</fo:inline>
6675
+ <xsl:value-of select="@reference"/>
6676
+
6677
+ <fo:inline font-style="normal">)</fo:inline>
6678
+
6679
+ </fo:inline>
6680
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6681
+ <xsl:copy-of select="./node()"/>
6682
+ </fo:inline>
6683
+
6684
+ </fo:block>
6675
6685
 
6676
- </fo:inline>
6677
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6678
- <xsl:copy-of select="./node()"/>
6679
- </fo:inline>
6680
- </fo:block>
6681
6686
  </xsl:if>
6682
6687
  </xsl:for-each>
6683
6688
  </xsl:template>
@@ -7618,12 +7623,12 @@
7618
7623
  <xsl:param name="value"/>
7619
7624
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
7620
7625
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
7621
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
7622
- <xsl:attribute name="height">5mm</xsl:attribute>
7626
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
7627
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
7623
7628
  <xsl:attribute name="content-width">100%</xsl:attribute>
7624
7629
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7625
7630
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7626
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7631
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7627
7632
  <g>
7628
7633
  <xsl:if test="$type = 'closing' or $type = 'end'">
7629
7634
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -7637,6 +7642,27 @@
7637
7642
  </xsl:if>
7638
7643
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
7639
7644
  </text>
7645
+ </svg> -->
7646
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7647
+ <g>
7648
+ <xsl:if test="$type = 'closing' or $type = 'end'">
7649
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
7650
+ </xsl:if>
7651
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
7652
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
7653
+ </g>
7654
+ <xsl:variable name="text_x">
7655
+ <xsl:choose>
7656
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
7657
+ <xsl:otherwise>22</xsl:otherwise>
7658
+ </xsl:choose>
7659
+ </xsl:variable>
7660
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
7661
+ <xsl:value-of select="$kind"/>
7662
+ </text>
7663
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
7664
+ <xsl:value-of select="$value"/>
7665
+ </text>
7640
7666
  </svg>
7641
7667
  </fo:instream-foreign-object>
7642
7668
  </xsl:template>
@@ -7891,18 +7917,20 @@
7891
7917
 
7892
7918
  <xsl:template name="add-zero-spaces-java">
7893
7919
  <xsl:param name="text" select="."/>
7894
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
7895
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
7920
+ <!-- add zero-width space (#x200B) after characters: dash, dot, equal, underscore, em dash, thin space, arrow right -->
7921
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|=|_|—| |→)','$1​')"/>
7922
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
7923
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(:)(\D)','$1​$2')"/>
7896
7924
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
7897
- <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' -->
7925
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
7898
7926
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
7899
- <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' -->
7927
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
7900
7928
  <!-- add zero-width space (#x200B) before character: { -->
7901
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7929
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7902
7930
  <!-- add zero-width space (#x200B) after character: , -->
7903
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7931
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7904
7932
 
7905
- <xsl:value-of select="$text5"/>
7933
+ <xsl:value-of select="$text6"/>
7906
7934
  </xsl:template>
7907
7935
 
7908
7936
  <xsl:template name="add-zero-spaces-link-java">
@@ -7911,7 +7939,9 @@
7911
7939
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7912
7940
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7913
7941
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7914
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7942
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7943
+ <!-- remove zero-width space at the end -->
7944
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7915
7945
  </xsl:template>
7916
7946
 
7917
7947
  <!-- add zero space after dash character (for table's entries) -->
@@ -8048,7 +8078,7 @@
8048
8078
  </xsl:copy>
8049
8079
  </xsl:template>
8050
8080
 
8051
- <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">
8081
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
8052
8082
  <xsl:copy>
8053
8083
  <xsl:copy-of select="@*"/>
8054
8084
  <p>
@@ -8124,6 +8154,14 @@
8124
8154
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
8125
8155
  </xsl:template>
8126
8156
 
8157
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
8158
+ <xsl:apply-templates mode="table-without-br"/>
8159
+ </xsl:template>
8160
+
8161
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
8162
+ <xsl:apply-templates mode="table-without-br"/>
8163
+ </xsl:template>
8164
+
8127
8165
  <!-- mode="table-without-br" -->
8128
8166
  <!-- ================================== -->
8129
8167
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -8982,7 +9020,7 @@
8982
9020
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
8983
9021
  </xsl:if>
8984
9022
 
8985
- <fo:block-container margin-left="0mm">
9023
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8986
9024
 
8987
9025
  <fo:block>
8988
9026
 
@@ -9181,11 +9219,14 @@
9181
9219
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
9182
9220
  </xsl:call-template>
9183
9221
 
9222
+ <!-- Example: Dimensions in millimeters -->
9223
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9224
+
9184
9225
  <fo:block xsl:use-attribute-sets="figure-style">
9185
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9226
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9186
9227
  </fo:block>
9187
9228
  <xsl:call-template name="fn_display_figure"/>
9188
- <xsl:for-each select="*[local-name() = 'note']">
9229
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9189
9230
  <xsl:call-template name="note"/>
9190
9231
  </xsl:for-each>
9191
9232
 
@@ -9442,24 +9483,47 @@
9442
9483
 
9443
9484
  </xsl:when>
9444
9485
  <xsl:otherwise>
9445
- <fo:block xsl:use-attribute-sets="image-style">
9446
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9447
- <xsl:attribute name="width">100%</xsl:attribute>
9448
- <xsl:attribute name="content-height">100%</xsl:attribute>
9449
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9450
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9451
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9452
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9453
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9454
- <!-- effective height / width = 1.48, 1.4 - with title -->
9455
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9456
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9457
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9458
- </xsl:if>
9459
- <xsl:attribute name="scaling">uniform</xsl:attribute>
9460
- <xsl:copy-of select="$svg_content"/>
9461
- </fo:instream-foreign-object>
9462
- </fo:block>
9486
+
9487
+ <xsl:variable name="element">
9488
+ <xsl:choose>
9489
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
9490
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
9491
+ </xsl:when>
9492
+ <xsl:otherwise>
9493
+ <fo:block xsl:use-attribute-sets="image-style">
9494
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
9495
+ <xsl:attribute name="text-align">left</xsl:attribute>
9496
+ </xsl:if>
9497
+ </fo:block>
9498
+ </xsl:otherwise>
9499
+ </xsl:choose>
9500
+ </xsl:variable>
9501
+
9502
+ <xsl:for-each select="xalan:nodeset($element)/*">
9503
+ <xsl:copy>
9504
+ <xsl:copy-of select="@*"/>
9505
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
9506
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9507
+ <xsl:if test="$isGenerateTableIF = 'false'">
9508
+ <xsl:attribute name="width">100%</xsl:attribute>
9509
+ </xsl:if>
9510
+ <xsl:attribute name="content-height">100%</xsl:attribute>
9511
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9512
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9513
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9514
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9515
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9516
+ <!-- effective height / width = 1.48, 1.4 - with title -->
9517
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9518
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9519
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9520
+ </xsl:if>
9521
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
9522
+ <xsl:copy-of select="$svg_content"/>
9523
+ </fo:instream-foreign-object>
9524
+ <!-- </fo:block> -->
9525
+ </xsl:copy>
9526
+ </xsl:for-each>
9463
9527
  </xsl:otherwise>
9464
9528
  </xsl:choose>
9465
9529
  </xsl:template>
@@ -9551,6 +9615,13 @@
9551
9615
  </xsl:for-each>
9552
9616
  </xsl:template>
9553
9617
 
9618
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
9619
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
9620
+ <xsl:for-each select="*[local-name() = 'svg']">
9621
+ <xsl:call-template name="image_svg"/>
9622
+ </xsl:for-each>
9623
+ </xsl:template>
9624
+
9554
9625
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
9555
9626
  <xsl:variable name="svg_content" select="document(@src)"/>
9556
9627
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9689,6 +9760,8 @@
9689
9760
  <xsl:value-of select="."/>
9690
9761
  </xsl:template>
9691
9762
 
9763
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
9764
+
9692
9765
  <xsl:template match="node()" mode="contents">
9693
9766
  <xsl:apply-templates mode="contents"/>
9694
9767
  </xsl:template>
@@ -10010,7 +10083,15 @@
10010
10083
  <xsl:value-of select="@section"/>
10011
10084
  <xsl:text> </xsl:text>
10012
10085
  </xsl:if>
10013
- <xsl:value-of select="normalize-space(title)"/>
10086
+ <xsl:variable name="title">
10087
+ <xsl:for-each select="title/node()">
10088
+ <xsl:choose>
10089
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
10090
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10091
+ </xsl:choose>
10092
+ </xsl:for-each>
10093
+ </xsl:variable>
10094
+ <xsl:value-of select="normalize-space($title)"/>
10014
10095
  </fo:bookmark-title>
10015
10096
  <xsl:apply-templates mode="bookmark"/>
10016
10097
  </fo:bookmark>
@@ -10036,6 +10117,12 @@
10036
10117
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
10037
10118
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10038
10119
 
10120
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
10121
+ <fo:block text-align="right" keep-with-next="always">
10122
+ <xsl:apply-templates/>
10123
+ </fo:block>
10124
+ </xsl:template>
10125
+
10039
10126
  <!-- ====== -->
10040
10127
  <!-- ====== -->
10041
10128
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -10185,6 +10272,10 @@
10185
10272
  </xsl:for-each>
10186
10273
  </xsl:template>
10187
10274
 
10275
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
10276
+ <xsl:value-of select="."/>
10277
+ </xsl:template>
10278
+
10188
10279
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10189
10280
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10190
10281
  <xsl:apply-templates mode="contents_item"/>