metanorma-un 0.10.2 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -875,14 +875,14 @@
875
875
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
876
876
 
877
877
  <!--
878
- <misc-container>
878
+ <metanorma-extension>
879
879
  <presentation-metadata>
880
880
  <papersize>letter</papersize>
881
881
  </presentation-metadata>
882
- </misc-container>
882
+ </metanorma-extension>
883
883
  -->
884
884
 
885
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
885
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
886
886
  <xsl:variable name="papersize_width_">
887
887
  <xsl:choose>
888
888
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -999,7 +999,7 @@
999
999
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
1000
1000
 
1001
1001
  <xsl:variable name="title-list-tables">
1002
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1002
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1003
1003
  <xsl:value-of select="$toc_table_title"/>
1004
1004
  <xsl:if test="normalize-space($toc_table_title) = ''">
1005
1005
  <xsl:call-template name="getTitle">
@@ -1009,7 +1009,7 @@
1009
1009
  </xsl:variable>
1010
1010
 
1011
1011
  <xsl:variable name="title-list-figures">
1012
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1012
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1013
1013
  <xsl:value-of select="$toc_figure_title"/>
1014
1014
  <xsl:if test="normalize-space($toc_figure_title) = ''">
1015
1015
  <xsl:call-template name="getTitle">
@@ -1019,7 +1019,7 @@
1019
1019
  </xsl:variable>
1020
1020
 
1021
1021
  <xsl:variable name="title-list-recommendations">
1022
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1022
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1023
1023
  <xsl:value-of select="$toc_requirement_title"/>
1024
1024
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
1025
1025
  <xsl:call-template name="getTitle">
@@ -1091,7 +1091,7 @@
1091
1091
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1092
1092
 
1093
1093
  <xsl:variable name="additional_fonts_">
1094
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1094
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1095
1095
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1096
1096
  </xsl:for-each>
1097
1097
  </xsl:variable>
@@ -2129,10 +2129,10 @@
2129
2129
 
2130
2130
  <xsl:template name="processTablesFigures_Contents">
2131
2131
  <xsl:param name="always"/>
2132
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2132
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2133
2133
  <xsl:call-template name="processTables_Contents"/>
2134
2134
  </xsl:if>
2135
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2135
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2136
2136
  <xsl:call-template name="processFigures_Contents"/>
2137
2137
  </xsl:if>
2138
2138
  </xsl:template>
@@ -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>
@@ -2478,6 +2479,8 @@
2478
2479
  <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2479
2480
  </xsl:if>
2480
2481
 
2482
+ <xsl:call-template name="setBordersTableArray"/>
2483
+
2481
2484
  <xsl:if test="ancestor::*[local-name()='sections']">
2482
2485
  <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute>
2483
2486
  <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute>
@@ -2580,7 +2583,7 @@
2580
2583
  <xsl:variable name="isDeleted" select="@deleted"/>
2581
2584
 
2582
2585
  <xsl:choose>
2583
- <xsl:when test="@width">
2586
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2584
2587
 
2585
2588
  <!-- centered table when table name is centered (see table-name-style) -->
2586
2589
 
@@ -2624,6 +2627,10 @@
2624
2627
 
2625
2628
  </xsl:template>
2626
2629
 
2630
+ <xsl:template name="setBordersTableArray">
2631
+
2632
+ </xsl:template>
2633
+
2627
2634
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2628
2635
  <xsl:param name="continued"/>
2629
2636
  <xsl:if test="normalize-space() != ''">
@@ -2898,6 +2905,7 @@
2898
2905
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2899
2906
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2900
2907
  <!-- difference between the available space and the minimum table width -->
2908
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2901
2909
  <xsl:variable name="W" select="$page_width - @width_min"/>
2902
2910
  <W><xsl:value-of select="$W"/></W>
2903
2911
  <!-- difference between maximum and minimum width of the table -->
@@ -3098,6 +3106,8 @@
3098
3106
  <fo:table-row>
3099
3107
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3100
3108
 
3109
+ <xsl:call-template name="setBordersTableArray"/>
3110
+
3101
3111
  <!-- fn will be processed inside 'note' processing -->
3102
3112
 
3103
3113
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3219,6 +3229,8 @@
3219
3229
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3220
3230
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3221
3231
 
3232
+ <xsl:call-template name="setBordersTableArray"/>
3233
+
3222
3234
  <xsl:call-template name="setTableRowAttributes"/>
3223
3235
 
3224
3236
  <xsl:apply-templates/>
@@ -3242,6 +3254,8 @@
3242
3254
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3243
3255
  </xsl:if>
3244
3256
 
3257
+ <xsl:call-template name="setBordersTableArray"/>
3258
+
3245
3259
  <xsl:call-template name="setTableRowAttributes"/>
3246
3260
  <xsl:apply-templates/>
3247
3261
  </fo:table-row>
@@ -3261,6 +3275,8 @@
3261
3275
  <xsl:with-param name="default">center</xsl:with-param>
3262
3276
  </xsl:call-template>
3263
3277
 
3278
+ <xsl:call-template name="setBordersTableArray"/>
3279
+
3264
3280
  <xsl:if test="ancestor::*[local-name()='sections']">
3265
3281
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3266
3282
  <xsl:attribute name="display-align">before</xsl:attribute>
@@ -3328,6 +3344,8 @@
3328
3344
 
3329
3345
  <!-- bsi -->
3330
3346
 
3347
+ <xsl:call-template name="setBordersTableArray"/>
3348
+
3331
3349
  <xsl:if test="ancestor::*[local-name()='sections']">
3332
3350
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3333
3351
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3529,17 +3547,20 @@
3529
3547
  <xsl:for-each select="xalan:nodeset($references)//fn">
3530
3548
  <xsl:variable name="reference" select="@reference"/>
3531
3549
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3532
- <fo:block xsl:use-attribute-sets="table-fn-style">
3533
3550
 
3534
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3551
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3535
3552
 
3536
- <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>
3537
3563
 
3538
- </fo:inline>
3539
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3540
- <xsl:copy-of select="./node()"/>
3541
- </fo:inline>
3542
- </fo:block>
3543
3564
  </xsl:if>
3544
3565
  </xsl:for-each>
3545
3566
  </xsl:template>
@@ -4475,12 +4496,12 @@
4475
4496
  <xsl:param name="value"/>
4476
4497
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4477
4498
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4478
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4479
- <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 -->
4480
4501
  <xsl:attribute name="content-width">100%</xsl:attribute>
4481
4502
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4482
4503
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4483
- <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">
4484
4505
  <g>
4485
4506
  <xsl:if test="$type = 'closing' or $type = 'end'">
4486
4507
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4494,6 +4515,27 @@
4494
4515
  </xsl:if>
4495
4516
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4496
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>
4497
4539
  </svg>
4498
4540
  </fo:instream-foreign-object>
4499
4541
  </xsl:template>
@@ -4748,18 +4790,20 @@
4748
4790
 
4749
4791
  <xsl:template name="add-zero-spaces-java">
4750
4792
  <xsl:param name="text" select="."/>
4751
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4752
- <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')"/>
4753
4797
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4754
- <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' -->
4755
4799
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4756
- <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' -->
4757
4801
  <!-- add zero-width space (#x200B) before character: { -->
4758
- <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' -->
4759
4803
  <!-- add zero-width space (#x200B) after character: , -->
4760
- <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 -->
4761
4805
 
4762
- <xsl:value-of select="$text5"/>
4806
+ <xsl:value-of select="$text6"/>
4763
4807
  </xsl:template>
4764
4808
 
4765
4809
  <xsl:template name="add-zero-spaces-link-java">
@@ -4768,7 +4812,9 @@
4768
4812
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4769
4813
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4770
4814
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4771
- <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), '​$', '')"/>
4772
4818
  </xsl:template>
4773
4819
 
4774
4820
  <!-- add zero space after dash character (for table's entries) -->
@@ -4905,7 +4951,7 @@
4905
4951
  </xsl:copy>
4906
4952
  </xsl:template>
4907
4953
 
4908
- <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">
4909
4955
  <xsl:copy>
4910
4956
  <xsl:copy-of select="@*"/>
4911
4957
  <p>
@@ -4981,6 +5027,14 @@
4981
5027
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4982
5028
  </xsl:template>
4983
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
+
4984
5038
  <!-- mode="table-without-br" -->
4985
5039
  <!-- ================================== -->
4986
5040
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5803,7 +5857,7 @@
5803
5857
  <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
5804
5858
  </xsl:if>
5805
5859
 
5806
- <fo:block-container margin-left="0mm">
5860
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5807
5861
 
5808
5862
  <fo:block>
5809
5863
 
@@ -5990,11 +6044,14 @@
5990
6044
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5991
6045
  </xsl:call-template>
5992
6046
 
6047
+ <!-- Example: Dimensions in millimeters -->
6048
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
6049
+
5993
6050
  <fo:block xsl:use-attribute-sets="figure-style">
5994
- <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')]"/>
5995
6052
  </fo:block>
5996
6053
  <xsl:call-template name="fn_display_figure"/>
5997
- <xsl:for-each select="*[local-name() = 'note']">
6054
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5998
6055
  <xsl:call-template name="note"/>
5999
6056
  </xsl:for-each>
6000
6057
 
@@ -6256,24 +6313,47 @@
6256
6313
 
6257
6314
  </xsl:when>
6258
6315
  <xsl:otherwise>
6259
- <fo:block xsl:use-attribute-sets="image-style">
6260
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6261
- <xsl:attribute name="width">100%</xsl:attribute>
6262
- <xsl:attribute name="content-height">100%</xsl:attribute>
6263
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6264
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6265
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6266
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6267
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6268
- <!-- effective height / width = 1.48, 1.4 - with title -->
6269
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6270
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6271
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6272
- </xsl:if>
6273
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6274
- <xsl:copy-of select="$svg_content"/>
6275
- </fo:instream-foreign-object>
6276
- </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>
6277
6357
  </xsl:otherwise>
6278
6358
  </xsl:choose>
6279
6359
  </xsl:template>
@@ -6365,6 +6445,13 @@
6365
6445
  </xsl:for-each>
6366
6446
  </xsl:template>
6367
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
+
6368
6455
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6369
6456
  <xsl:variable name="svg_content" select="document(@src)"/>
6370
6457
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6503,6 +6590,8 @@
6503
6590
  <xsl:value-of select="."/>
6504
6591
  </xsl:template>
6505
6592
 
6593
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6594
+
6506
6595
  <xsl:template match="node()" mode="contents">
6507
6596
  <xsl:apply-templates mode="contents"/>
6508
6597
  </xsl:template>
@@ -6810,7 +6899,15 @@
6810
6899
  <xsl:value-of select="@section"/>
6811
6900
  <xsl:text> </xsl:text>
6812
6901
  </xsl:if>
6813
- <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)"/>
6814
6911
  </fo:bookmark-title>
6815
6912
  <xsl:apply-templates mode="bookmark"/>
6816
6913
  </fo:bookmark>
@@ -6836,6 +6933,12 @@
6836
6933
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6837
6934
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6838
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
+
6839
6942
  <!-- ====== -->
6840
6943
  <!-- ====== -->
6841
6944
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6985,6 +7088,10 @@
6985
7088
  </xsl:for-each>
6986
7089
  </xsl:template>
6987
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
+
6988
7095
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6989
7096
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6990
7097
  <xsl:apply-templates mode="contents_item"/>
@@ -6994,7 +7101,7 @@
6994
7101
  <!-- sourcecode -->
6995
7102
  <!-- =============== -->
6996
7103
 
6997
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7104
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6998
7105
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6999
7106
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7000
7107
 
@@ -9039,8 +9146,8 @@
9039
9146
 
9040
9147
  <xsl:variable name="toc_level">
9041
9148
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
9042
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
9043
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
9149
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
9150
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
9044
9151
  <xsl:choose>
9045
9152
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
9046
9153
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -10037,6 +10144,7 @@
10037
10144
  <xsl:choose>
10038
10145
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
10039
10146
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
10147
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
10040
10148
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
10041
10149
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
10042
10150
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -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">
@@ -1316,7 +1326,7 @@
1316
1326
  <value>commentaryOf</value>
1317
1327
  <value>hasCommentary</value>
1318
1328
  <value>related</value>
1319
- <value>complements</value>
1329
+ <value>hasComplement</value>
1320
1330
  <value>complementOf</value>
1321
1331
  <value>obsoletes</value>
1322
1332
  <value>obsoletedBy</value>
@@ -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,10 +1578,13 @@
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">
1583
- <element name="misc-container">
1587
+ <element name="metanorma-extension">
1584
1588
  <oneOrMore>
1585
1589
  <ref name="AnyElement"/>
1586
1590
  </oneOrMore>
@@ -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.2".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.2
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: 2022-12-30 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