metanorma-bipm 2.5.2 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 383bf45f87ea65566e738977584c76a596ce22c419a58aa571f4bffab61c06ae
4
- data.tar.gz: dcf5f78ced811ad1bf65ac8fd41c6c35bfe71310baa1d922ed587694d29ddaa7
3
+ metadata.gz: ee327f237eb974834aa08e30a8377060d464252f817649d3706a92fa6b7b37ba
4
+ data.tar.gz: d3b799388ebe8e53161960f16f8ca90fb6a1337521a68aa592296171614879f9
5
5
  SHA512:
6
- metadata.gz: b74015cf3c36fbba63afb772b18898cdb5f6c44176f8ceaba504f8966e3be23d58c5a68e5fe048dcad41773d38bb605f74dd676c70a99ac8c3a016b9635c67f3
7
- data.tar.gz: 3b11a266828af1d89b41cd261f4c1270430067b4b62f700ac952598900c4610646251c3586c98371cd2f6f37cc8d5334829413168483c4498724e291f6fd3a40
6
+ metadata.gz: 1b6d93eca87a36e2c20ae4b426b50ab4cac17edf39306eaf8ac02bebf10294deb0209caaca64fd2b6c0c6b7023901b394217adcde589bcc11d2f9134a6bc1760
7
+ data.tar.gz: b5d58c60cdfba890e5895cbb62a7496b1b454dec763afa064120cf8a999b06e8da1f4703471fb6269dba7f3569458883e9718f2e32a1418e1a118064e4b9f97c
@@ -1,12 +1,12 @@
1
1
  require "isodoc"
2
2
 
3
3
  module IsoDoc
4
- module BIPM
4
+ module Bipm
5
5
  module BaseConvert
6
6
  attr_accessor :jcgm
7
7
 
8
8
  def configuration
9
- Metanorma::BIPM.configuration
9
+ Metanorma::Bipm.configuration
10
10
  end
11
11
 
12
12
  TOP_ELEMENTS = IsoDoc::Function::ToWordHtml::TOP_ELEMENTS +
@@ -7137,6 +7137,7 @@
7137
7137
 
7138
7138
  <fo:block role="SKIP">
7139
7139
  <xsl:apply-templates/>
7140
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
7140
7141
  </fo:block>
7141
7142
  </fo:table-cell>
7142
7143
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -7209,6 +7210,8 @@
7209
7210
 
7210
7211
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
7211
7212
 
7213
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
7214
+
7212
7215
  </fo:block>
7213
7216
  </fo:table-cell>
7214
7217
  </xsl:template> <!-- td -->
@@ -7284,7 +7287,8 @@
7284
7287
  </xsl:choose>
7285
7288
  </xsl:variable>
7286
7289
  <xsl:variable name="current_fn_number_text">
7287
- <xsl:value-of select="$current_fn_number"/>
7290
+
7291
+ <xsl:value-of select="$current_fn_number"/>
7288
7292
 
7289
7293
  </xsl:variable>
7290
7294
 
@@ -7320,8 +7324,10 @@
7320
7324
 
7321
7325
  <xsl:call-template name="insert_basic_link">
7322
7326
  <xsl:with-param name="element">
7323
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7324
- <xsl:copy-of select="$current_fn_number_text"/>
7327
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7328
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7329
+ <xsl:copy-of select="$current_fn_number_text"/>
7330
+ </fo:inline>
7325
7331
  </fo:basic-link>
7326
7332
  </xsl:with-param>
7327
7333
  </xsl:call-template>
@@ -7606,7 +7612,7 @@
7606
7612
 
7607
7613
  <xsl:call-template name="refine_fn-reference-style"/>
7608
7614
 
7609
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7615
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7610
7616
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7611
7617
  <xsl:attribute name="internal-destination">
7612
7618
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8609,9 +8615,19 @@
8609
8615
  </fo:inline>
8610
8616
  </xsl:template>
8611
8617
 
8612
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]">
8618
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
8619
+ <xsl:param name="txt"/>
8613
8620
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8614
- <xsl:variable name="text" select="."/>
8621
+ <xsl:variable name="text">
8622
+ <xsl:choose>
8623
+ <xsl:when test="$txt != ''">
8624
+ <xsl:value-of select="$txt"/>
8625
+ </xsl:when>
8626
+ <xsl:otherwise>
8627
+ <xsl:value-of select="."/>
8628
+ </xsl:otherwise>
8629
+ </xsl:choose>
8630
+ </xsl:variable>
8615
8631
  <xsl:variable name="ratio_">
8616
8632
  0.75
8617
8633
  </xsl:variable>
@@ -10037,14 +10053,16 @@
10037
10053
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10038
10054
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10039
10055
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10056
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
10040
10057
  <xsl:variable name="target">
10041
10058
  <xsl:choose>
10042
10059
  <xsl:when test="@updatetype = 'true'">
10043
10060
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10044
10061
  </xsl:when>
10045
10062
  <!-- link to the PDF attachment -->
10046
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
10047
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10063
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
10064
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
10065
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
10048
10066
  </xsl:when>
10049
10067
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10050
10068
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -10075,6 +10093,11 @@
10075
10093
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10076
10094
  </xsl:if>
10077
10095
 
10096
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10097
+ <xsl:attribute name="color">inherit</xsl:attribute>
10098
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
10099
+ </xsl:if>
10100
+
10078
10101
  <xsl:call-template name="refine_link-style"/>
10079
10102
 
10080
10103
  <xsl:choose>
@@ -10082,9 +10105,15 @@
10082
10105
  <xsl:apply-templates/>
10083
10106
  </xsl:when>
10084
10107
  <xsl:otherwise>
10108
+ <xsl:variable name="alt_text">
10109
+ <xsl:call-template name="getAltText"/>
10110
+ </xsl:variable>
10085
10111
  <xsl:call-template name="insert_basic_link">
10086
10112
  <xsl:with-param name="element">
10087
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10113
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
10114
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10115
+ <xsl:attribute name="role">Annot</xsl:attribute>
10116
+ </xsl:if>
10088
10117
  <xsl:choose>
10089
10118
  <xsl:when test="normalize-space(.) = ''">
10090
10119
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -10097,6 +10126,10 @@
10097
10126
  </xsl:otherwise>
10098
10127
  </xsl:choose>
10099
10128
  </fo:basic-link>
10129
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10130
+ <!-- reserve space at right for PaperClip icon -->
10131
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
10132
+ </xsl:if>
10100
10133
  </xsl:with-param>
10101
10134
  </xsl:call-template>
10102
10135
  </xsl:otherwise>
@@ -10104,6 +10137,14 @@
10104
10137
  </fo:inline>
10105
10138
  </xsl:template> <!-- link -->
10106
10139
 
10140
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getAltText">
10141
+ <xsl:choose>
10142
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
10143
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
10144
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
10145
+ </xsl:choose>
10146
+ </xsl:template>
10147
+
10107
10148
  <!-- ======================== -->
10108
10149
  <!-- Appendix processing -->
10109
10150
  <!-- ======================== -->
@@ -10134,7 +10175,7 @@
10134
10175
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10135
10176
  <xsl:choose>
10136
10177
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10137
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10178
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10138
10179
  </xsl:choose>
10139
10180
  </xsl:template>
10140
10181
 
@@ -10163,7 +10204,10 @@
10163
10204
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10164
10205
  <xsl:call-template name="insert_basic_link">
10165
10206
  <xsl:with-param name="element">
10166
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
10207
+ <xsl:variable name="alt_text">
10208
+ <xsl:call-template name="getAltText"/>
10209
+ </xsl:variable>
10210
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
10167
10211
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
10168
10212
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10169
10213
  </xsl:if>
@@ -12676,12 +12720,14 @@
12676
12720
 
12677
12721
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12678
12722
 
12679
- <xsl:variable name="provisional_distance_between_starts">
12723
+ <xsl:variable name="provisional_distance_between_starts_">
12680
12724
  7
12681
12725
  </xsl:variable>
12682
- <xsl:variable name="indent">
12726
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12727
+ <xsl:variable name="indent_">
12683
12728
  0
12684
12729
  </xsl:variable>
12730
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12685
12731
 
12686
12732
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12687
12733
  <fo:list-item>
@@ -13410,14 +13456,17 @@
13410
13456
  </xsl:when>
13411
13457
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13412
13458
 
13413
- <xsl:variable name="label">
13459
+ <xsl:variable name="type" select="../@type"/>
13414
13460
 
13415
- <xsl:variable name="type" select="../@type"/>
13461
+ <xsl:variable name="label">
13416
13462
 
13417
13463
  <xsl:variable name="style_prefix_">
13418
13464
  <xsl:if test="$type = 'roman'">
13419
13465
  ( <!-- Example: (i) -->
13420
13466
  </xsl:if>
13467
+ <xsl:if test="$type = 'alphabet'">
13468
+
13469
+ </xsl:if>
13421
13470
  </xsl:variable>
13422
13471
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13423
13472
 
@@ -13443,13 +13492,15 @@
13443
13492
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13444
13493
  <xsl:value-of select="$style_prefix"/>
13445
13494
  </xsl:if>
13495
+
13446
13496
  <xsl:value-of select="@label"/>
13497
+
13447
13498
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13448
13499
  <xsl:value-of select="$style_suffix"/>
13449
13500
  </xsl:if>
13450
13501
  </xsl:variable>
13451
13502
 
13452
- <xsl:value-of select="normalize-space($label)"/>
13503
+ <xsl:value-of select="normalize-space($label)"/>
13453
13504
 
13454
13505
  </xsl:when>
13455
13506
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15642,9 +15693,15 @@
15642
15693
  </x:xmpmeta>
15643
15694
  <!-- add attachments -->
15644
15695
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
15645
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
15646
-
15647
- <pdf:embedded-file filename="{@name}">
15696
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
15697
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
15698
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15699
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15700
+ <!-- Todo: need update -->
15701
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15702
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15703
+
15704
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15648
15705
  <xsl:attribute name="src">
15649
15706
  <xsl:choose>
15650
15707
  <xsl:when test="normalize-space() != ''">
@@ -15660,18 +15717,34 @@
15660
15717
  <xsl:if test="$description != ''">
15661
15718
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15662
15719
  </xsl:if>
15720
+ <xsl:if test="$afrelationship != ''">
15721
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15722
+ </xsl:if>
15723
+ <xsl:if test="$volatile != ''">
15724
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15725
+ </xsl:if>
15663
15726
  </pdf:embedded-file>
15664
15727
  </xsl:for-each>
15665
15728
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
15666
15729
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
15667
15730
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
15668
15731
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
15732
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
15669
15733
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15670
15734
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15671
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
15735
+ <!-- Todo: need update -->
15736
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15737
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15738
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15672
15739
  <xsl:if test="$description != ''">
15673
15740
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15674
15741
  </xsl:if>
15742
+ <xsl:if test="$afrelationship != ''">
15743
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15744
+ </xsl:if>
15745
+ <xsl:if test="$volatile != ''">
15746
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15747
+ </xsl:if>
15675
15748
  </pdf:embedded-file>
15676
15749
  </xsl:for-each>
15677
15750
  </xsl:if>
@@ -15691,6 +15764,12 @@
15691
15764
  <!-- Get or calculate depth of the element -->
15692
15765
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getLevel">
15693
15766
  <xsl:param name="depth"/>
15767
+ <!-- <xsl:message>
15768
+ <xsl:choose>
15769
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
15770
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
15771
+ </xsl:choose>
15772
+ </xsl:message> -->
15694
15773
  <xsl:choose>
15695
15774
  <xsl:when test="normalize-space(@depth) != ''">
15696
15775
  <xsl:value-of select="@depth"/>
@@ -15711,8 +15790,48 @@
15711
15790
  <xsl:when test="ancestor::*[local-name() = 'preface']">
15712
15791
  <xsl:value-of select="$level_total - 2"/>
15713
15792
  </xsl:when>
15793
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15794
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
15795
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
15796
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
15797
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
15798
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
15799
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
15800
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
15801
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
15802
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
15803
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
15804
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
15805
+ <xsl:choose>
15806
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
15807
+ <xsl:value-of select="number($curr_clause_depth)"/>
15808
+ </xsl:when>
15809
+ <xsl:otherwise>
15810
+ <xsl:value-of select="$level_total - 2"/>
15811
+ </xsl:otherwise>
15812
+ </xsl:choose>
15813
+ </xsl:when>
15814
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
15815
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15816
+ <xsl:choose>
15817
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
15818
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
15819
+ </xsl:when>
15820
+ <xsl:otherwise>
15821
+ <xsl:value-of select="$level_total - 2"/>
15822
+ </xsl:otherwise>
15823
+ </xsl:choose>
15824
+ </xsl:when>
15714
15825
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15715
- <xsl:value-of select="$level_total - 1"/>
15826
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15827
+ <xsl:choose>
15828
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15829
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
15830
+ </xsl:when>
15831
+ <xsl:otherwise>
15832
+ <xsl:value-of select="$level_total - 1"/>
15833
+ </xsl:otherwise>
15834
+ </xsl:choose>
15716
15835
  </xsl:when>
15717
15836
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
15718
15837
  <xsl:value-of select="$level_total - 1"/>
@@ -15720,6 +15839,17 @@
15720
15839
  <xsl:when test="parent::*[local-name() = 'annex']">
15721
15840
  <xsl:value-of select="$level_total - 1"/>
15722
15841
  </xsl:when>
15842
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
15843
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15844
+ <xsl:choose>
15845
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15846
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
15847
+ </xsl:when>
15848
+ <xsl:otherwise>
15849
+ <xsl:value-of select="$level_total - 1"/>
15850
+ </xsl:otherwise>
15851
+ </xsl:choose>
15852
+ </xsl:when>
15723
15853
  <xsl:when test="ancestor::*[local-name() = 'annex']">
15724
15854
  <xsl:value-of select="$level_total"/>
15725
15855
  </xsl:when>
@@ -16078,6 +16208,20 @@
16078
16208
 
16079
16209
  <!-- END: insert cover page image -->
16080
16210
 
16211
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertVerticalChar">
16212
+ <xsl:param name="str"/>
16213
+ <xsl:if test="string-length($str) &gt; 0">
16214
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
16215
+ <fo:block-container width="1em">
16216
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
16217
+ </fo:block-container>
16218
+ </fo:inline-container>
16219
+ <xsl:call-template name="insertVerticalChar">
16220
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16221
+ </xsl:call-template>
16222
+ </xsl:if>
16223
+ </xsl:template>
16224
+
16081
16225
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
16082
16226
  <xsl:param name="number"/>
16083
16227
  <xsl:param name="first"/>
@@ -16365,4 +16509,18 @@
16365
16509
  </xsl:if>
16366
16510
  </xsl:template>
16367
16511
 
16512
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="@*|node()" mode="set_table_role_skip">
16513
+ <xsl:copy>
16514
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
16515
+ </xsl:copy>
16516
+ </xsl:template>
16517
+
16518
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
16519
+ <xsl:copy>
16520
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
16521
+ <xsl:attribute name="role">SKIP</xsl:attribute>
16522
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
16523
+ </xsl:copy>
16524
+ </xsl:template>
16525
+
16368
16526
  </xsl:stylesheet>