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.
@@ -794,14 +794,14 @@
794
794
  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 -->
795
795
 
796
796
  <!--
797
- <misc-container>
797
+ <metanorma-extension>
798
798
  <presentation-metadata>
799
799
  <papersize>letter</papersize>
800
800
  </presentation-metadata>
801
- </misc-container>
801
+ </metanorma-extension>
802
802
  -->
803
803
 
804
- <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'])))"/>
804
+ <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'])))"/>
805
805
  <xsl:variable name="papersize_width_">
806
806
  <xsl:choose>
807
807
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -916,7 +916,7 @@
916
916
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
917
917
 
918
918
  <xsl:variable name="title-list-tables">
919
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
919
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
920
920
  <xsl:value-of select="$toc_table_title"/>
921
921
  <xsl:if test="normalize-space($toc_table_title) = ''">
922
922
  <xsl:call-template name="getTitle">
@@ -926,7 +926,7 @@
926
926
  </xsl:variable>
927
927
 
928
928
  <xsl:variable name="title-list-figures">
929
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
929
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
930
930
  <xsl:value-of select="$toc_figure_title"/>
931
931
  <xsl:if test="normalize-space($toc_figure_title) = ''">
932
932
  <xsl:call-template name="getTitle">
@@ -936,7 +936,7 @@
936
936
  </xsl:variable>
937
937
 
938
938
  <xsl:variable name="title-list-recommendations">
939
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
939
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
940
940
  <xsl:value-of select="$toc_requirement_title"/>
941
941
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
942
942
  <xsl:call-template name="getTitle">
@@ -1008,7 +1008,7 @@
1008
1008
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1009
1009
 
1010
1010
  <xsl:variable name="additional_fonts_">
1011
- <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']">
1011
+ <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']">
1012
1012
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1013
1013
  </xsl:for-each>
1014
1014
  </xsl:variable>
@@ -2061,10 +2061,10 @@
2061
2061
 
2062
2062
  <xsl:template name="processTablesFigures_Contents">
2063
2063
  <xsl:param name="always"/>
2064
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2064
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2065
2065
  <xsl:call-template name="processTables_Contents"/>
2066
2066
  </xsl:if>
2067
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2067
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2068
2068
  <xsl:call-template name="processFigures_Contents"/>
2069
2069
  </xsl:if>
2070
2070
  </xsl:template>
@@ -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>
@@ -2406,6 +2407,8 @@
2406
2407
  <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2407
2408
  </xsl:if>
2408
2409
 
2410
+ <xsl:call-template name="setBordersTableArray"/>
2411
+
2409
2412
  </xsl:element>
2410
2413
  </xsl:variable>
2411
2414
 
@@ -2503,7 +2506,7 @@
2503
2506
  <xsl:variable name="isDeleted" select="@deleted"/>
2504
2507
 
2505
2508
  <xsl:choose>
2506
- <xsl:when test="@width">
2509
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2507
2510
 
2508
2511
  <!-- centered table when table name is centered (see table-name-style) -->
2509
2512
 
@@ -2547,6 +2550,10 @@
2547
2550
 
2548
2551
  </xsl:template>
2549
2552
 
2553
+ <xsl:template name="setBordersTableArray">
2554
+
2555
+ </xsl:template>
2556
+
2550
2557
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2551
2558
  <xsl:param name="continued"/>
2552
2559
  <xsl:if test="normalize-space() != ''">
@@ -2821,6 +2828,7 @@
2821
2828
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2822
2829
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2823
2830
  <!-- difference between the available space and the minimum table width -->
2831
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2824
2832
  <xsl:variable name="W" select="$page_width - @width_min"/>
2825
2833
  <W><xsl:value-of select="$W"/></W>
2826
2834
  <!-- difference between maximum and minimum width of the table -->
@@ -3021,6 +3029,8 @@
3021
3029
  <fo:table-row>
3022
3030
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3023
3031
 
3032
+ <xsl:call-template name="setBordersTableArray"/>
3033
+
3024
3034
  <!-- fn will be processed inside 'note' processing -->
3025
3035
 
3026
3036
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3142,6 +3152,8 @@
3142
3152
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3143
3153
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3144
3154
 
3155
+ <xsl:call-template name="setBordersTableArray"/>
3156
+
3145
3157
  <xsl:call-template name="setTableRowAttributes"/>
3146
3158
 
3147
3159
  <xsl:apply-templates/>
@@ -3165,6 +3177,8 @@
3165
3177
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3166
3178
  </xsl:if>
3167
3179
 
3180
+ <xsl:call-template name="setBordersTableArray"/>
3181
+
3168
3182
  <xsl:call-template name="setTableRowAttributes"/>
3169
3183
  <xsl:apply-templates/>
3170
3184
  </fo:table-row>
@@ -3188,6 +3202,8 @@
3188
3202
  <xsl:with-param name="default">center</xsl:with-param>
3189
3203
  </xsl:call-template>
3190
3204
 
3205
+ <xsl:call-template name="setBordersTableArray"/>
3206
+
3191
3207
  <xsl:if test="$lang = 'ar'">
3192
3208
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3193
3209
  </xsl:if>
@@ -3240,6 +3256,8 @@
3240
3256
 
3241
3257
  <!-- bsi -->
3242
3258
 
3259
+ <xsl:call-template name="setBordersTableArray"/>
3260
+
3243
3261
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3244
3262
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3245
3263
  </xsl:if>
@@ -3436,17 +3454,20 @@
3436
3454
  <xsl:for-each select="xalan:nodeset($references)//fn">
3437
3455
  <xsl:variable name="reference" select="@reference"/>
3438
3456
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3439
- <fo:block xsl:use-attribute-sets="table-fn-style">
3440
3457
 
3441
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3458
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3442
3459
 
3443
- <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>
3444
3470
 
3445
- </fo:inline>
3446
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3447
- <xsl:copy-of select="./node()"/>
3448
- </fo:inline>
3449
- </fo:block>
3450
3471
  </xsl:if>
3451
3472
  </xsl:for-each>
3452
3473
  </xsl:template>
@@ -4382,12 +4403,12 @@
4382
4403
  <xsl:param name="value"/>
4383
4404
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4384
4405
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4385
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4386
- <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 -->
4387
4408
  <xsl:attribute name="content-width">100%</xsl:attribute>
4388
4409
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4389
4410
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4390
- <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">
4391
4412
  <g>
4392
4413
  <xsl:if test="$type = 'closing' or $type = 'end'">
4393
4414
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4401,6 +4422,27 @@
4401
4422
  </xsl:if>
4402
4423
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4403
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>
4404
4446
  </svg>
4405
4447
  </fo:instream-foreign-object>
4406
4448
  </xsl:template>
@@ -4655,18 +4697,20 @@
4655
4697
 
4656
4698
  <xsl:template name="add-zero-spaces-java">
4657
4699
  <xsl:param name="text" select="."/>
4658
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4659
- <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')"/>
4660
4704
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4661
- <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' -->
4662
4706
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4663
- <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' -->
4664
4708
  <!-- add zero-width space (#x200B) before character: { -->
4665
- <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' -->
4666
4710
  <!-- add zero-width space (#x200B) after character: , -->
4667
- <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 -->
4668
4712
 
4669
- <xsl:value-of select="$text5"/>
4713
+ <xsl:value-of select="$text6"/>
4670
4714
  </xsl:template>
4671
4715
 
4672
4716
  <xsl:template name="add-zero-spaces-link-java">
@@ -4675,7 +4719,9 @@
4675
4719
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4676
4720
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4677
4721
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4678
- <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), '​$', '')"/>
4679
4725
  </xsl:template>
4680
4726
 
4681
4727
  <!-- add zero space after dash character (for table's entries) -->
@@ -4812,7 +4858,7 @@
4812
4858
  </xsl:copy>
4813
4859
  </xsl:template>
4814
4860
 
4815
- <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">
4816
4862
  <xsl:copy>
4817
4863
  <xsl:copy-of select="@*"/>
4818
4864
  <p>
@@ -4888,6 +4934,14 @@
4888
4934
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4889
4935
  </xsl:template>
4890
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
+
4891
4945
  <!-- mode="table-without-br" -->
4892
4946
  <!-- ================================== -->
4893
4947
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5706,7 +5760,7 @@
5706
5760
 
5707
5761
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5708
5762
 
5709
- <fo:block-container margin-left="0mm">
5763
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5710
5764
 
5711
5765
  <fo:block>
5712
5766
 
@@ -5893,11 +5947,14 @@
5893
5947
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5894
5948
  </xsl:call-template>
5895
5949
 
5950
+ <!-- Example: Dimensions in millimeters -->
5951
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5952
+
5896
5953
  <fo:block xsl:use-attribute-sets="figure-style">
5897
- <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')]"/>
5898
5955
  </fo:block>
5899
5956
  <xsl:call-template name="fn_display_figure"/>
5900
- <xsl:for-each select="*[local-name() = 'note']">
5957
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5901
5958
  <xsl:call-template name="note"/>
5902
5959
  </xsl:for-each>
5903
5960
 
@@ -6154,24 +6211,47 @@
6154
6211
 
6155
6212
  </xsl:when>
6156
6213
  <xsl:otherwise>
6157
- <fo:block xsl:use-attribute-sets="image-style">
6158
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6159
- <xsl:attribute name="width">100%</xsl:attribute>
6160
- <xsl:attribute name="content-height">100%</xsl:attribute>
6161
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6162
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6163
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6164
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6165
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6166
- <!-- effective height / width = 1.48, 1.4 - with title -->
6167
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6168
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6169
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6170
- </xsl:if>
6171
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6172
- <xsl:copy-of select="$svg_content"/>
6173
- </fo:instream-foreign-object>
6174
- </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>
6175
6255
  </xsl:otherwise>
6176
6256
  </xsl:choose>
6177
6257
  </xsl:template>
@@ -6263,6 +6343,13 @@
6263
6343
  </xsl:for-each>
6264
6344
  </xsl:template>
6265
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
+
6266
6353
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6267
6354
  <xsl:variable name="svg_content" select="document(@src)"/>
6268
6355
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6401,6 +6488,8 @@
6401
6488
  <xsl:value-of select="."/>
6402
6489
  </xsl:template>
6403
6490
 
6491
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6492
+
6404
6493
  <xsl:template match="node()" mode="contents">
6405
6494
  <xsl:apply-templates mode="contents"/>
6406
6495
  </xsl:template>
@@ -6708,7 +6797,15 @@
6708
6797
  <xsl:value-of select="@section"/>
6709
6798
  <xsl:text> </xsl:text>
6710
6799
  </xsl:if>
6711
- <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)"/>
6712
6809
  </fo:bookmark-title>
6713
6810
  <xsl:apply-templates mode="bookmark"/>
6714
6811
  </fo:bookmark>
@@ -6734,6 +6831,12 @@
6734
6831
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6735
6832
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6736
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
+
6737
6840
  <!-- ====== -->
6738
6841
  <!-- ====== -->
6739
6842
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6883,6 +6986,10 @@
6883
6986
  </xsl:for-each>
6884
6987
  </xsl:template>
6885
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
+
6886
6993
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6887
6994
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6888
6995
  <xsl:apply-templates mode="contents_item"/>
@@ -6892,7 +6999,7 @@
6892
6999
  <!-- sourcecode -->
6893
7000
  <!-- =============== -->
6894
7001
 
6895
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7002
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6896
7003
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6897
7004
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6898
7005
 
@@ -8937,8 +9044,8 @@
8937
9044
 
8938
9045
  <xsl:variable name="toc_level">
8939
9046
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
8940
- <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:-->
8941
- <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 -->
9047
+ <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:-->
9048
+ <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 -->
8942
9049
  <xsl:choose>
8943
9050
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
8944
9051
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -9934,6 +10041,7 @@
9934
10041
  <xsl:choose>
9935
10042
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
9936
10043
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
10044
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
9937
10045
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
9938
10046
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
9939
10047
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>