metanorma-un 0.10.3 → 0.10.4

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: 41ff83b6e3a4da6dd0d9ecb65321c39aabfcfe70ba20bda707f7ea991ef9eac2
4
- data.tar.gz: 709e49ec42a2b2ea48ed225601f2d8a0716cdfdd864d5aec6c775ad454617f1d
3
+ metadata.gz: c0d3975df160060e9876ded5a77afe98911c0af285cd938276d2b484a8c1315a
4
+ data.tar.gz: '069bf630ea252f0604f6c5748a0ddcfcf2d2e02e4e8f7999e11c21066995c46f'
5
5
  SHA512:
6
- metadata.gz: db75076f8afb99308b895bcd318effaaf271e7c5588334307bf057dd82af901cd62065142a5cc9d13ec99b36609bbb77adc747d18764b4e063ec8ae5651c6580
7
- data.tar.gz: 4f7d1c1a7c2295aaab897f2f1322b1d775d8ee1ecb5b2c425752cbd88db67534492cce9a3312654384aebbac3c50f9602761405bace87c524c1220d72560fcae
6
+ metadata.gz: 0fc842448fe0ce51727b09f339f53f2612a9df4eeb843888c33fae0c10b4f5210a4739cbbad02cebad5dd3da97e93b715feb2b701658dcb156c27392ccc7764a
7
+ data.tar.gz: d77051bc251a1c98f8c1d8b70deb795c37585e1a556aedcd8a49c5545649b143bc826155bdb3dab90d8eb8ef359e41ac15f283e75e71f2a965a6ef8f9c2182a0
@@ -431,6 +431,10 @@ p {
431
431
  max-width: 100%;
432
432
  height: auto; }
433
433
 
434
+ table div.figure {
435
+ padding: 0;
436
+ margin: 0; }
437
+
434
438
  /*
435
439
  Document types + stages
436
440
  */
@@ -139,6 +139,13 @@ nav {
139
139
  @include figureBlock();
140
140
  }
141
141
 
142
+ table div.figure {
143
+ padding: 0;
144
+ margin: 0;
145
+ }
146
+
147
+
148
+
142
149
  /*
143
150
  Document types + stages
144
151
  */
@@ -2384,6 +2384,7 @@
2384
2384
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2385
2385
 
2386
2386
  <xsl:choose>
2387
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
2387
2388
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2388
2389
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
2389
2390
  </xsl:choose>
@@ -2505,7 +2506,7 @@
2505
2506
  <xsl:variable name="isDeleted" select="@deleted"/>
2506
2507
 
2507
2508
  <xsl:choose>
2508
- <xsl:when test="@width">
2509
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2509
2510
 
2510
2511
  <!-- centered table when table name is centered (see table-name-style) -->
2511
2512
 
@@ -2827,6 +2828,7 @@
2827
2828
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2828
2829
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2829
2830
  <!-- difference between the available space and the minimum table width -->
2831
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2830
2832
  <xsl:variable name="W" select="$page_width - @width_min"/>
2831
2833
  <W><xsl:value-of select="$W"/></W>
2832
2834
  <!-- difference between maximum and minimum width of the table -->
@@ -3452,17 +3454,20 @@
3452
3454
  <xsl:for-each select="xalan:nodeset($references)//fn">
3453
3455
  <xsl:variable name="reference" select="@reference"/>
3454
3456
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3455
- <fo:block xsl:use-attribute-sets="table-fn-style">
3456
3457
 
3457
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3458
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3458
3459
 
3459
- <xsl:value-of select="@reference"/>
3460
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3461
+
3462
+ <xsl:value-of select="@reference"/>
3463
+
3464
+ </fo:inline>
3465
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3466
+ <xsl:copy-of select="./node()"/>
3467
+ </fo:inline>
3468
+
3469
+ </fo:block>
3460
3470
 
3461
- </fo:inline>
3462
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3463
- <xsl:copy-of select="./node()"/>
3464
- </fo:inline>
3465
- </fo:block>
3466
3471
  </xsl:if>
3467
3472
  </xsl:for-each>
3468
3473
  </xsl:template>
@@ -4398,12 +4403,12 @@
4398
4403
  <xsl:param name="value"/>
4399
4404
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4400
4405
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4401
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4402
- <xsl:attribute name="height">5mm</xsl:attribute>
4406
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4407
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4403
4408
  <xsl:attribute name="content-width">100%</xsl:attribute>
4404
4409
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4405
4410
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4406
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4411
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4407
4412
  <g>
4408
4413
  <xsl:if test="$type = 'closing' or $type = 'end'">
4409
4414
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4417,6 +4422,27 @@
4417
4422
  </xsl:if>
4418
4423
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4419
4424
  </text>
4425
+ </svg> -->
4426
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4427
+ <g>
4428
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4429
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4430
+ </xsl:if>
4431
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4432
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4433
+ </g>
4434
+ <xsl:variable name="text_x">
4435
+ <xsl:choose>
4436
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4437
+ <xsl:otherwise>22</xsl:otherwise>
4438
+ </xsl:choose>
4439
+ </xsl:variable>
4440
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4441
+ <xsl:value-of select="$kind"/>
4442
+ </text>
4443
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4444
+ <xsl:value-of select="$value"/>
4445
+ </text>
4420
4446
  </svg>
4421
4447
  </fo:instream-foreign-object>
4422
4448
  </xsl:template>
@@ -4671,18 +4697,20 @@
4671
4697
 
4672
4698
  <xsl:template name="add-zero-spaces-java">
4673
4699
  <xsl:param name="text" select="."/>
4674
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4675
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4700
+ <!-- add zero-width space (#x200B) after characters: dash, dot, equal, underscore, em dash, thin space, arrow right -->
4701
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|=|_|—| |→)','$1​')"/>
4702
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4703
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(:)(\D)','$1​$2')"/>
4676
4704
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4677
- <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' -->
4705
+ <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' -->
4678
4706
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4679
- <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' -->
4707
+ <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' -->
4680
4708
  <!-- add zero-width space (#x200B) before character: { -->
4681
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4709
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4682
4710
  <!-- add zero-width space (#x200B) after character: , -->
4683
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4711
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4684
4712
 
4685
- <xsl:value-of select="$text5"/>
4713
+ <xsl:value-of select="$text6"/>
4686
4714
  </xsl:template>
4687
4715
 
4688
4716
  <xsl:template name="add-zero-spaces-link-java">
@@ -4691,7 +4719,9 @@
4691
4719
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4692
4720
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4693
4721
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4694
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4722
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4723
+ <!-- remove zero-width space at the end -->
4724
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4695
4725
  </xsl:template>
4696
4726
 
4697
4727
  <!-- add zero space after dash character (for table's entries) -->
@@ -4828,7 +4858,7 @@
4828
4858
  </xsl:copy>
4829
4859
  </xsl:template>
4830
4860
 
4831
- <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">
4861
+ <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">
4832
4862
  <xsl:copy>
4833
4863
  <xsl:copy-of select="@*"/>
4834
4864
  <p>
@@ -4904,6 +4934,14 @@
4904
4934
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4905
4935
  </xsl:template>
4906
4936
 
4937
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4938
+ <xsl:apply-templates mode="table-without-br"/>
4939
+ </xsl:template>
4940
+
4941
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4942
+ <xsl:apply-templates mode="table-without-br"/>
4943
+ </xsl:template>
4944
+
4907
4945
  <!-- mode="table-without-br" -->
4908
4946
  <!-- ================================== -->
4909
4947
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5722,7 +5760,7 @@
5722
5760
 
5723
5761
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5724
5762
 
5725
- <fo:block-container margin-left="0mm">
5763
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5726
5764
 
5727
5765
  <fo:block>
5728
5766
 
@@ -5909,11 +5947,14 @@
5909
5947
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5910
5948
  </xsl:call-template>
5911
5949
 
5950
+ <!-- Example: Dimensions in millimeters -->
5951
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5952
+
5912
5953
  <fo:block xsl:use-attribute-sets="figure-style">
5913
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5954
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5914
5955
  </fo:block>
5915
5956
  <xsl:call-template name="fn_display_figure"/>
5916
- <xsl:for-each select="*[local-name() = 'note']">
5957
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5917
5958
  <xsl:call-template name="note"/>
5918
5959
  </xsl:for-each>
5919
5960
 
@@ -6170,24 +6211,47 @@
6170
6211
 
6171
6212
  </xsl:when>
6172
6213
  <xsl:otherwise>
6173
- <fo:block xsl:use-attribute-sets="image-style">
6174
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6175
- <xsl:attribute name="width">100%</xsl:attribute>
6176
- <xsl:attribute name="content-height">100%</xsl:attribute>
6177
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6178
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6179
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6180
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6181
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6182
- <!-- effective height / width = 1.48, 1.4 - with title -->
6183
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6184
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6185
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6186
- </xsl:if>
6187
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6188
- <xsl:copy-of select="$svg_content"/>
6189
- </fo:instream-foreign-object>
6190
- </fo:block>
6214
+
6215
+ <xsl:variable name="element">
6216
+ <xsl:choose>
6217
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6218
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6219
+ </xsl:when>
6220
+ <xsl:otherwise>
6221
+ <fo:block xsl:use-attribute-sets="image-style">
6222
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6223
+ <xsl:attribute name="text-align">left</xsl:attribute>
6224
+ </xsl:if>
6225
+ </fo:block>
6226
+ </xsl:otherwise>
6227
+ </xsl:choose>
6228
+ </xsl:variable>
6229
+
6230
+ <xsl:for-each select="xalan:nodeset($element)/*">
6231
+ <xsl:copy>
6232
+ <xsl:copy-of select="@*"/>
6233
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6234
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6235
+ <xsl:if test="$isGenerateTableIF = 'false'">
6236
+ <xsl:attribute name="width">100%</xsl:attribute>
6237
+ </xsl:if>
6238
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6239
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6240
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6241
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6242
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6243
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6244
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6245
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6246
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6247
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6248
+ </xsl:if>
6249
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6250
+ <xsl:copy-of select="$svg_content"/>
6251
+ </fo:instream-foreign-object>
6252
+ <!-- </fo:block> -->
6253
+ </xsl:copy>
6254
+ </xsl:for-each>
6191
6255
  </xsl:otherwise>
6192
6256
  </xsl:choose>
6193
6257
  </xsl:template>
@@ -6279,6 +6343,13 @@
6279
6343
  </xsl:for-each>
6280
6344
  </xsl:template>
6281
6345
 
6346
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6347
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6348
+ <xsl:for-each select="*[local-name() = 'svg']">
6349
+ <xsl:call-template name="image_svg"/>
6350
+ </xsl:for-each>
6351
+ </xsl:template>
6352
+
6282
6353
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6283
6354
  <xsl:variable name="svg_content" select="document(@src)"/>
6284
6355
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6417,6 +6488,8 @@
6417
6488
  <xsl:value-of select="."/>
6418
6489
  </xsl:template>
6419
6490
 
6491
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6492
+
6420
6493
  <xsl:template match="node()" mode="contents">
6421
6494
  <xsl:apply-templates mode="contents"/>
6422
6495
  </xsl:template>
@@ -6724,7 +6797,15 @@
6724
6797
  <xsl:value-of select="@section"/>
6725
6798
  <xsl:text> </xsl:text>
6726
6799
  </xsl:if>
6727
- <xsl:value-of select="normalize-space(title)"/>
6800
+ <xsl:variable name="title">
6801
+ <xsl:for-each select="title/node()">
6802
+ <xsl:choose>
6803
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6804
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6805
+ </xsl:choose>
6806
+ </xsl:for-each>
6807
+ </xsl:variable>
6808
+ <xsl:value-of select="normalize-space($title)"/>
6728
6809
  </fo:bookmark-title>
6729
6810
  <xsl:apply-templates mode="bookmark"/>
6730
6811
  </fo:bookmark>
@@ -6750,6 +6831,12 @@
6750
6831
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6751
6832
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6752
6833
 
6834
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6835
+ <fo:block text-align="right" keep-with-next="always">
6836
+ <xsl:apply-templates/>
6837
+ </fo:block>
6838
+ </xsl:template>
6839
+
6753
6840
  <!-- ====== -->
6754
6841
  <!-- ====== -->
6755
6842
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6899,6 +6986,10 @@
6899
6986
  </xsl:for-each>
6900
6987
  </xsl:template>
6901
6988
 
6989
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
6990
+ <xsl:value-of select="."/>
6991
+ </xsl:template>
6992
+
6902
6993
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6903
6994
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6904
6995
  <xsl:apply-templates mode="contents_item"/>
@@ -2384,6 +2384,7 @@
2384
2384
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2385
2385
 
2386
2386
  <xsl:choose>
2387
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
2387
2388
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2388
2389
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
2389
2390
  </xsl:choose>
@@ -2505,7 +2506,7 @@
2505
2506
  <xsl:variable name="isDeleted" select="@deleted"/>
2506
2507
 
2507
2508
  <xsl:choose>
2508
- <xsl:when test="@width">
2509
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2509
2510
 
2510
2511
  <!-- centered table when table name is centered (see table-name-style) -->
2511
2512
 
@@ -2827,6 +2828,7 @@
2827
2828
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2828
2829
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2829
2830
  <!-- difference between the available space and the minimum table width -->
2831
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2830
2832
  <xsl:variable name="W" select="$page_width - @width_min"/>
2831
2833
  <W><xsl:value-of select="$W"/></W>
2832
2834
  <!-- difference between maximum and minimum width of the table -->
@@ -3452,17 +3454,20 @@
3452
3454
  <xsl:for-each select="xalan:nodeset($references)//fn">
3453
3455
  <xsl:variable name="reference" select="@reference"/>
3454
3456
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3455
- <fo:block xsl:use-attribute-sets="table-fn-style">
3456
3457
 
3457
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3458
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3458
3459
 
3459
- <xsl:value-of select="@reference"/>
3460
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3461
+
3462
+ <xsl:value-of select="@reference"/>
3463
+
3464
+ </fo:inline>
3465
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3466
+ <xsl:copy-of select="./node()"/>
3467
+ </fo:inline>
3468
+
3469
+ </fo:block>
3460
3470
 
3461
- </fo:inline>
3462
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3463
- <xsl:copy-of select="./node()"/>
3464
- </fo:inline>
3465
- </fo:block>
3466
3471
  </xsl:if>
3467
3472
  </xsl:for-each>
3468
3473
  </xsl:template>
@@ -4398,12 +4403,12 @@
4398
4403
  <xsl:param name="value"/>
4399
4404
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4400
4405
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4401
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4402
- <xsl:attribute name="height">5mm</xsl:attribute>
4406
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4407
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4403
4408
  <xsl:attribute name="content-width">100%</xsl:attribute>
4404
4409
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4405
4410
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4406
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4411
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4407
4412
  <g>
4408
4413
  <xsl:if test="$type = 'closing' or $type = 'end'">
4409
4414
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4417,6 +4422,27 @@
4417
4422
  </xsl:if>
4418
4423
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4419
4424
  </text>
4425
+ </svg> -->
4426
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4427
+ <g>
4428
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4429
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4430
+ </xsl:if>
4431
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4432
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4433
+ </g>
4434
+ <xsl:variable name="text_x">
4435
+ <xsl:choose>
4436
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4437
+ <xsl:otherwise>22</xsl:otherwise>
4438
+ </xsl:choose>
4439
+ </xsl:variable>
4440
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4441
+ <xsl:value-of select="$kind"/>
4442
+ </text>
4443
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4444
+ <xsl:value-of select="$value"/>
4445
+ </text>
4420
4446
  </svg>
4421
4447
  </fo:instream-foreign-object>
4422
4448
  </xsl:template>
@@ -4671,18 +4697,20 @@
4671
4697
 
4672
4698
  <xsl:template name="add-zero-spaces-java">
4673
4699
  <xsl:param name="text" select="."/>
4674
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4675
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4700
+ <!-- add zero-width space (#x200B) after characters: dash, dot, equal, underscore, em dash, thin space, arrow right -->
4701
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|=|_|—| |→)','$1​')"/>
4702
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4703
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(:)(\D)','$1​$2')"/>
4676
4704
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4677
- <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' -->
4705
+ <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' -->
4678
4706
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4679
- <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' -->
4707
+ <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' -->
4680
4708
  <!-- add zero-width space (#x200B) before character: { -->
4681
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4709
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4682
4710
  <!-- add zero-width space (#x200B) after character: , -->
4683
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4711
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4684
4712
 
4685
- <xsl:value-of select="$text5"/>
4713
+ <xsl:value-of select="$text6"/>
4686
4714
  </xsl:template>
4687
4715
 
4688
4716
  <xsl:template name="add-zero-spaces-link-java">
@@ -4691,7 +4719,9 @@
4691
4719
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4692
4720
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4693
4721
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4694
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4722
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4723
+ <!-- remove zero-width space at the end -->
4724
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4695
4725
  </xsl:template>
4696
4726
 
4697
4727
  <!-- add zero space after dash character (for table's entries) -->
@@ -4828,7 +4858,7 @@
4828
4858
  </xsl:copy>
4829
4859
  </xsl:template>
4830
4860
 
4831
- <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">
4861
+ <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">
4832
4862
  <xsl:copy>
4833
4863
  <xsl:copy-of select="@*"/>
4834
4864
  <p>
@@ -4904,6 +4934,14 @@
4904
4934
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4905
4935
  </xsl:template>
4906
4936
 
4937
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4938
+ <xsl:apply-templates mode="table-without-br"/>
4939
+ </xsl:template>
4940
+
4941
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4942
+ <xsl:apply-templates mode="table-without-br"/>
4943
+ </xsl:template>
4944
+
4907
4945
  <!-- mode="table-without-br" -->
4908
4946
  <!-- ================================== -->
4909
4947
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5722,7 +5760,7 @@
5722
5760
 
5723
5761
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5724
5762
 
5725
- <fo:block-container margin-left="0mm">
5763
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5726
5764
 
5727
5765
  <fo:block>
5728
5766
 
@@ -5909,11 +5947,14 @@
5909
5947
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5910
5948
  </xsl:call-template>
5911
5949
 
5950
+ <!-- Example: Dimensions in millimeters -->
5951
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5952
+
5912
5953
  <fo:block xsl:use-attribute-sets="figure-style">
5913
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5954
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5914
5955
  </fo:block>
5915
5956
  <xsl:call-template name="fn_display_figure"/>
5916
- <xsl:for-each select="*[local-name() = 'note']">
5957
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5917
5958
  <xsl:call-template name="note"/>
5918
5959
  </xsl:for-each>
5919
5960
 
@@ -6170,24 +6211,47 @@
6170
6211
 
6171
6212
  </xsl:when>
6172
6213
  <xsl:otherwise>
6173
- <fo:block xsl:use-attribute-sets="image-style">
6174
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6175
- <xsl:attribute name="width">100%</xsl:attribute>
6176
- <xsl:attribute name="content-height">100%</xsl:attribute>
6177
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6178
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6179
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6180
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6181
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6182
- <!-- effective height / width = 1.48, 1.4 - with title -->
6183
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6184
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6185
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6186
- </xsl:if>
6187
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6188
- <xsl:copy-of select="$svg_content"/>
6189
- </fo:instream-foreign-object>
6190
- </fo:block>
6214
+
6215
+ <xsl:variable name="element">
6216
+ <xsl:choose>
6217
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6218
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6219
+ </xsl:when>
6220
+ <xsl:otherwise>
6221
+ <fo:block xsl:use-attribute-sets="image-style">
6222
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6223
+ <xsl:attribute name="text-align">left</xsl:attribute>
6224
+ </xsl:if>
6225
+ </fo:block>
6226
+ </xsl:otherwise>
6227
+ </xsl:choose>
6228
+ </xsl:variable>
6229
+
6230
+ <xsl:for-each select="xalan:nodeset($element)/*">
6231
+ <xsl:copy>
6232
+ <xsl:copy-of select="@*"/>
6233
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6234
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6235
+ <xsl:if test="$isGenerateTableIF = 'false'">
6236
+ <xsl:attribute name="width">100%</xsl:attribute>
6237
+ </xsl:if>
6238
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6239
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6240
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6241
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6242
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6243
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6244
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6245
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6246
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6247
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6248
+ </xsl:if>
6249
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6250
+ <xsl:copy-of select="$svg_content"/>
6251
+ </fo:instream-foreign-object>
6252
+ <!-- </fo:block> -->
6253
+ </xsl:copy>
6254
+ </xsl:for-each>
6191
6255
  </xsl:otherwise>
6192
6256
  </xsl:choose>
6193
6257
  </xsl:template>
@@ -6279,6 +6343,13 @@
6279
6343
  </xsl:for-each>
6280
6344
  </xsl:template>
6281
6345
 
6346
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6347
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6348
+ <xsl:for-each select="*[local-name() = 'svg']">
6349
+ <xsl:call-template name="image_svg"/>
6350
+ </xsl:for-each>
6351
+ </xsl:template>
6352
+
6282
6353
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6283
6354
  <xsl:variable name="svg_content" select="document(@src)"/>
6284
6355
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6417,6 +6488,8 @@
6417
6488
  <xsl:value-of select="."/>
6418
6489
  </xsl:template>
6419
6490
 
6491
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6492
+
6420
6493
  <xsl:template match="node()" mode="contents">
6421
6494
  <xsl:apply-templates mode="contents"/>
6422
6495
  </xsl:template>
@@ -6724,7 +6797,15 @@
6724
6797
  <xsl:value-of select="@section"/>
6725
6798
  <xsl:text> </xsl:text>
6726
6799
  </xsl:if>
6727
- <xsl:value-of select="normalize-space(title)"/>
6800
+ <xsl:variable name="title">
6801
+ <xsl:for-each select="title/node()">
6802
+ <xsl:choose>
6803
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6804
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6805
+ </xsl:choose>
6806
+ </xsl:for-each>
6807
+ </xsl:variable>
6808
+ <xsl:value-of select="normalize-space($title)"/>
6728
6809
  </fo:bookmark-title>
6729
6810
  <xsl:apply-templates mode="bookmark"/>
6730
6811
  </fo:bookmark>
@@ -6750,6 +6831,12 @@
6750
6831
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6751
6832
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6752
6833
 
6834
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6835
+ <fo:block text-align="right" keep-with-next="always">
6836
+ <xsl:apply-templates/>
6837
+ </fo:block>
6838
+ </xsl:template>
6839
+
6753
6840
  <!-- ====== -->
6754
6841
  <!-- ====== -->
6755
6842
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6899,6 +6986,10 @@
6899
6986
  </xsl:for-each>
6900
6987
  </xsl:template>
6901
6988
 
6989
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
6990
+ <xsl:value-of select="."/>
6991
+ </xsl:template>
6992
+
6902
6993
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6903
6994
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6904
6995
  <xsl:apply-templates mode="contents_item"/>
@@ -2456,6 +2456,7 @@
2456
2456
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2457
2457
 
2458
2458
  <xsl:choose>
2459
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
2459
2460
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2460
2461
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
2461
2462
  </xsl:choose>
@@ -2582,7 +2583,7 @@
2582
2583
  <xsl:variable name="isDeleted" select="@deleted"/>
2583
2584
 
2584
2585
  <xsl:choose>
2585
- <xsl:when test="@width">
2586
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2586
2587
 
2587
2588
  <!-- centered table when table name is centered (see table-name-style) -->
2588
2589
 
@@ -2904,6 +2905,7 @@
2904
2905
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2905
2906
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2906
2907
  <!-- difference between the available space and the minimum table width -->
2908
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2907
2909
  <xsl:variable name="W" select="$page_width - @width_min"/>
2908
2910
  <W><xsl:value-of select="$W"/></W>
2909
2911
  <!-- difference between maximum and minimum width of the table -->
@@ -3545,17 +3547,20 @@
3545
3547
  <xsl:for-each select="xalan:nodeset($references)//fn">
3546
3548
  <xsl:variable name="reference" select="@reference"/>
3547
3549
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3548
- <fo:block xsl:use-attribute-sets="table-fn-style">
3549
3550
 
3550
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3551
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3551
3552
 
3552
- <xsl:value-of select="@reference"/>
3553
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3554
+
3555
+ <xsl:value-of select="@reference"/>
3556
+
3557
+ </fo:inline>
3558
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3559
+ <xsl:copy-of select="./node()"/>
3560
+ </fo:inline>
3561
+
3562
+ </fo:block>
3553
3563
 
3554
- </fo:inline>
3555
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3556
- <xsl:copy-of select="./node()"/>
3557
- </fo:inline>
3558
- </fo:block>
3559
3564
  </xsl:if>
3560
3565
  </xsl:for-each>
3561
3566
  </xsl:template>
@@ -4491,12 +4496,12 @@
4491
4496
  <xsl:param name="value"/>
4492
4497
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4493
4498
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4494
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4495
- <xsl:attribute name="height">5mm</xsl:attribute>
4499
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4500
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4496
4501
  <xsl:attribute name="content-width">100%</xsl:attribute>
4497
4502
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4498
4503
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4499
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4504
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4500
4505
  <g>
4501
4506
  <xsl:if test="$type = 'closing' or $type = 'end'">
4502
4507
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4510,6 +4515,27 @@
4510
4515
  </xsl:if>
4511
4516
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4512
4517
  </text>
4518
+ </svg> -->
4519
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4520
+ <g>
4521
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4522
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4523
+ </xsl:if>
4524
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4525
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4526
+ </g>
4527
+ <xsl:variable name="text_x">
4528
+ <xsl:choose>
4529
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4530
+ <xsl:otherwise>22</xsl:otherwise>
4531
+ </xsl:choose>
4532
+ </xsl:variable>
4533
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4534
+ <xsl:value-of select="$kind"/>
4535
+ </text>
4536
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4537
+ <xsl:value-of select="$value"/>
4538
+ </text>
4513
4539
  </svg>
4514
4540
  </fo:instream-foreign-object>
4515
4541
  </xsl:template>
@@ -4764,18 +4790,20 @@
4764
4790
 
4765
4791
  <xsl:template name="add-zero-spaces-java">
4766
4792
  <xsl:param name="text" select="."/>
4767
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4768
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4793
+ <!-- add zero-width space (#x200B) after characters: dash, dot, equal, underscore, em dash, thin space, arrow right -->
4794
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|=|_|—| |→)','$1​')"/>
4795
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4796
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(:)(\D)','$1​$2')"/>
4769
4797
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4770
- <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' -->
4798
+ <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' -->
4771
4799
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4772
- <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' -->
4800
+ <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' -->
4773
4801
  <!-- add zero-width space (#x200B) before character: { -->
4774
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4802
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4775
4803
  <!-- add zero-width space (#x200B) after character: , -->
4776
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4804
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4777
4805
 
4778
- <xsl:value-of select="$text5"/>
4806
+ <xsl:value-of select="$text6"/>
4779
4807
  </xsl:template>
4780
4808
 
4781
4809
  <xsl:template name="add-zero-spaces-link-java">
@@ -4784,7 +4812,9 @@
4784
4812
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4785
4813
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4786
4814
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4787
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4815
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4816
+ <!-- remove zero-width space at the end -->
4817
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4788
4818
  </xsl:template>
4789
4819
 
4790
4820
  <!-- add zero space after dash character (for table's entries) -->
@@ -4921,7 +4951,7 @@
4921
4951
  </xsl:copy>
4922
4952
  </xsl:template>
4923
4953
 
4924
- <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">
4954
+ <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">
4925
4955
  <xsl:copy>
4926
4956
  <xsl:copy-of select="@*"/>
4927
4957
  <p>
@@ -4997,6 +5027,14 @@
4997
5027
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4998
5028
  </xsl:template>
4999
5029
 
5030
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
5031
+ <xsl:apply-templates mode="table-without-br"/>
5032
+ </xsl:template>
5033
+
5034
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
5035
+ <xsl:apply-templates mode="table-without-br"/>
5036
+ </xsl:template>
5037
+
5000
5038
  <!-- mode="table-without-br" -->
5001
5039
  <!-- ================================== -->
5002
5040
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5819,7 +5857,7 @@
5819
5857
  <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
5820
5858
  </xsl:if>
5821
5859
 
5822
- <fo:block-container margin-left="0mm">
5860
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5823
5861
 
5824
5862
  <fo:block>
5825
5863
 
@@ -6006,11 +6044,14 @@
6006
6044
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
6007
6045
  </xsl:call-template>
6008
6046
 
6047
+ <!-- Example: Dimensions in millimeters -->
6048
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
6049
+
6009
6050
  <fo:block xsl:use-attribute-sets="figure-style">
6010
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6051
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
6011
6052
  </fo:block>
6012
6053
  <xsl:call-template name="fn_display_figure"/>
6013
- <xsl:for-each select="*[local-name() = 'note']">
6054
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
6014
6055
  <xsl:call-template name="note"/>
6015
6056
  </xsl:for-each>
6016
6057
 
@@ -6272,24 +6313,47 @@
6272
6313
 
6273
6314
  </xsl:when>
6274
6315
  <xsl:otherwise>
6275
- <fo:block xsl:use-attribute-sets="image-style">
6276
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6277
- <xsl:attribute name="width">100%</xsl:attribute>
6278
- <xsl:attribute name="content-height">100%</xsl:attribute>
6279
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6280
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6281
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6282
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6283
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6284
- <!-- effective height / width = 1.48, 1.4 - with title -->
6285
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6286
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6287
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6288
- </xsl:if>
6289
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6290
- <xsl:copy-of select="$svg_content"/>
6291
- </fo:instream-foreign-object>
6292
- </fo:block>
6316
+
6317
+ <xsl:variable name="element">
6318
+ <xsl:choose>
6319
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6320
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6321
+ </xsl:when>
6322
+ <xsl:otherwise>
6323
+ <fo:block xsl:use-attribute-sets="image-style">
6324
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6325
+ <xsl:attribute name="text-align">left</xsl:attribute>
6326
+ </xsl:if>
6327
+ </fo:block>
6328
+ </xsl:otherwise>
6329
+ </xsl:choose>
6330
+ </xsl:variable>
6331
+
6332
+ <xsl:for-each select="xalan:nodeset($element)/*">
6333
+ <xsl:copy>
6334
+ <xsl:copy-of select="@*"/>
6335
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6336
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6337
+ <xsl:if test="$isGenerateTableIF = 'false'">
6338
+ <xsl:attribute name="width">100%</xsl:attribute>
6339
+ </xsl:if>
6340
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6341
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6342
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6343
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6344
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6345
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6346
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6347
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6348
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6349
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6350
+ </xsl:if>
6351
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6352
+ <xsl:copy-of select="$svg_content"/>
6353
+ </fo:instream-foreign-object>
6354
+ <!-- </fo:block> -->
6355
+ </xsl:copy>
6356
+ </xsl:for-each>
6293
6357
  </xsl:otherwise>
6294
6358
  </xsl:choose>
6295
6359
  </xsl:template>
@@ -6381,6 +6445,13 @@
6381
6445
  </xsl:for-each>
6382
6446
  </xsl:template>
6383
6447
 
6448
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6449
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6450
+ <xsl:for-each select="*[local-name() = 'svg']">
6451
+ <xsl:call-template name="image_svg"/>
6452
+ </xsl:for-each>
6453
+ </xsl:template>
6454
+
6384
6455
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6385
6456
  <xsl:variable name="svg_content" select="document(@src)"/>
6386
6457
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6519,6 +6590,8 @@
6519
6590
  <xsl:value-of select="."/>
6520
6591
  </xsl:template>
6521
6592
 
6593
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6594
+
6522
6595
  <xsl:template match="node()" mode="contents">
6523
6596
  <xsl:apply-templates mode="contents"/>
6524
6597
  </xsl:template>
@@ -6826,7 +6899,15 @@
6826
6899
  <xsl:value-of select="@section"/>
6827
6900
  <xsl:text> </xsl:text>
6828
6901
  </xsl:if>
6829
- <xsl:value-of select="normalize-space(title)"/>
6902
+ <xsl:variable name="title">
6903
+ <xsl:for-each select="title/node()">
6904
+ <xsl:choose>
6905
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6906
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6907
+ </xsl:choose>
6908
+ </xsl:for-each>
6909
+ </xsl:variable>
6910
+ <xsl:value-of select="normalize-space($title)"/>
6830
6911
  </fo:bookmark-title>
6831
6912
  <xsl:apply-templates mode="bookmark"/>
6832
6913
  </fo:bookmark>
@@ -6852,6 +6933,12 @@
6852
6933
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6853
6934
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6854
6935
 
6936
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6937
+ <fo:block text-align="right" keep-with-next="always">
6938
+ <xsl:apply-templates/>
6939
+ </fo:block>
6940
+ </xsl:template>
6941
+
6855
6942
  <!-- ====== -->
6856
6943
  <!-- ====== -->
6857
6944
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -7001,6 +7088,10 @@
7001
7088
  </xsl:for-each>
7002
7089
  </xsl:template>
7003
7090
 
7091
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7092
+ <xsl:value-of select="."/>
7093
+ </xsl:template>
7094
+
7004
7095
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
7005
7096
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
7006
7097
  <xsl:apply-templates mode="contents_item"/>
@@ -522,7 +522,6 @@
522
522
  <value>tip</value>
523
523
  <value>important</value>
524
524
  <value>caution</value>
525
- <value>statement</value>
526
525
  </choice>
527
526
  </define>
528
527
  <define name="figure">
@@ -216,6 +216,9 @@
216
216
  <optional>
217
217
  <ref name="fullname"/>
218
218
  </optional>
219
+ <zeroOrMore>
220
+ <ref name="credential"/>
221
+ </zeroOrMore>
219
222
  <zeroOrMore>
220
223
  <ref name="affiliation"/>
221
224
  </zeroOrMore>
@@ -232,6 +235,11 @@
232
235
  <ref name="FullNameType"/>
233
236
  </element>
234
237
  </define>
238
+ <define name="credential">
239
+ <element name="credential">
240
+ <text/>
241
+ </element>
242
+ </define>
235
243
  <define name="FullNameType">
236
244
  <choice>
237
245
  <group>
@@ -305,7 +313,9 @@
305
313
  <zeroOrMore>
306
314
  <ref name="affiliationdescription"/>
307
315
  </zeroOrMore>
308
- <ref name="organization"/>
316
+ <optional>
317
+ <ref name="organization"/>
318
+ </optional>
309
319
  </element>
310
320
  </define>
311
321
  <define name="affiliationname">
@@ -36,13 +36,12 @@ module Metanorma
36
36
 
37
37
  def title(node, xml)
38
38
  ["en"].each do |lang|
39
- xml.title **{ type: "main", language: lang,
40
- format: "text/plain" } do |t|
39
+ xml.title type: "main", language: lang, format: "text/plain" do |t|
41
40
  t << (asciidoc_sub(node.attr("title")) || node.title)
42
41
  end
43
42
  node.attr("subtitle") and
44
- xml.title **{ type: "subtitle", language: lang,
45
- format: "text/plain" } do |t|
43
+ xml.title type: "subtitle", language: lang,
44
+ format: "text/plain" do |t|
46
45
  t << asciidoc_sub(node.attr("subtitle"))
47
46
  end
48
47
  end
@@ -55,6 +54,7 @@ module Metanorma
55
54
  .stage_abbr(docstatus)
56
55
  dn = "#{dn}(#{abbr})" unless abbr.empty?
57
56
  end
57
+ id = node.attr("docidentifier") and dn = id
58
58
  xml.docidentifier { |i| i << dn }
59
59
  xml.docnumber { |i| i << node.attr("docnumber") }
60
60
  end
@@ -179,7 +179,7 @@ module Metanorma
179
179
  end
180
180
 
181
181
  def no_number_subheadings(xmldoc)
182
- xmldoc.xpath("//sections/clause | "\
182
+ xmldoc.xpath("//sections/clause | " \
183
183
  "//sections/definitions | //annex").each do |s|
184
184
  s.xpath(".//clause | .//definitions").each do |c|
185
185
  c["unnumbered"] = true
@@ -66,6 +66,7 @@
66
66
  <value>caution</value>
67
67
  <value>statement</value>
68
68
  <value>editorial</value>
69
+ <value>box</value>
69
70
  </choice>
70
71
  </define>
71
72
  <define name="index">
@@ -1577,6 +1578,9 @@
1577
1578
  <zeroOrMore>
1578
1579
  <ref name="indexsect"/>
1579
1580
  </zeroOrMore>
1581
+ <optional>
1582
+ <ref name="colophon"/>
1583
+ </optional>
1580
1584
  </element>
1581
1585
  </define>
1582
1586
  <define name="misccontainer">
@@ -1599,6 +1603,13 @@
1599
1603
  </oneOrMore>
1600
1604
  </element>
1601
1605
  </define>
1606
+ <define name="colophon">
1607
+ <element name="colophon">
1608
+ <oneOrMore>
1609
+ <ref name="content"/>
1610
+ </oneOrMore>
1611
+ </element>
1612
+ </define>
1602
1613
  <define name="foreword">
1603
1614
  <element name="foreword">
1604
1615
  <ref name="Content-Section"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.10.3".freeze
3
+ VERSION = "0.10.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639