metanorma-itu 2.5.3 → 2.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/base_convert.rb +1 -1
  3. data/lib/isodoc/itu/cleanup.rb +1 -1
  4. data/lib/isodoc/itu/html/_coverpage.css +3 -0
  5. data/lib/isodoc/itu/html/htmlstyle.css +6 -0
  6. data/lib/isodoc/itu/html_convert.rb +1 -1
  7. data/lib/isodoc/itu/i18n.rb +1 -1
  8. data/lib/isodoc/itu/init.rb +2 -2
  9. data/lib/isodoc/itu/itu.implementers-guide.xsl +179 -21
  10. data/lib/isodoc/itu/itu.in-force.xsl +179 -21
  11. data/lib/isodoc/itu/itu.recommendation-annex.xsl +179 -21
  12. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +179 -21
  13. data/lib/isodoc/itu/itu.recommendation.xsl +179 -21
  14. data/lib/isodoc/itu/itu.resolution.xsl +179 -21
  15. data/lib/isodoc/itu/itu.service-publication.xsl +179 -21
  16. data/lib/isodoc/itu/itu.technical-paper.xsl +179 -21
  17. data/lib/isodoc/itu/itu.technical-report.xsl +179 -21
  18. data/lib/isodoc/itu/metadata.rb +2 -2
  19. data/lib/isodoc/itu/metadata_date.rb +1 -1
  20. data/lib/isodoc/itu/pdf_convert.rb +1 -1
  21. data/lib/isodoc/itu/presentation_bibdata.rb +1 -1
  22. data/lib/isodoc/itu/presentation_contribution.rb +1 -1
  23. data/lib/isodoc/itu/presentation_preface.rb +1 -1
  24. data/lib/isodoc/itu/presentation_ref.rb +1 -1
  25. data/lib/isodoc/itu/presentation_xml_convert.rb +1 -1
  26. data/lib/isodoc/itu/ref.rb +1 -1
  27. data/lib/isodoc/itu/terms.rb +1 -1
  28. data/lib/isodoc/itu/word_cleanup.rb +1 -1
  29. data/lib/isodoc/itu/word_convert.rb +1 -1
  30. data/lib/isodoc/itu/xref.rb +2 -2
  31. data/lib/isodoc/itu/xref_section.rb +1 -1
  32. data/lib/isodoc/itu.rb +1 -1
  33. data/lib/metanorma/itu/biblio-standoc.rng +13 -0
  34. data/lib/metanorma/itu/biblio.rng +19 -12
  35. data/lib/metanorma/itu/cleanup.rb +1 -1
  36. data/lib/metanorma/itu/cleanup_section.rb +1 -1
  37. data/lib/metanorma/itu/converter.rb +6 -6
  38. data/lib/metanorma/itu/front.rb +2 -1
  39. data/lib/metanorma/itu/front_id.rb +1 -1
  40. data/lib/metanorma/itu/processor.rb +6 -6
  41. data/lib/metanorma/itu/relaton-itu.rng +1 -0
  42. data/lib/metanorma/itu/validate.rb +1 -1
  43. data/lib/metanorma/itu/version.rb +2 -2
  44. data/lib/metanorma/itu.rb +1 -1
  45. data/lib/metanorma-itu.rb +1 -1
  46. data/lib/relaton/render/general.rb +2 -2
  47. data/lib/relaton/render/parse.rb +1 -1
  48. data/metanorma-itu.gemspec +1 -1
  49. metadata +2 -2
@@ -5994,6 +5994,7 @@
5994
5994
 
5995
5995
  <fo:block role="SKIP">
5996
5996
  <xsl:apply-templates/>
5997
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5997
5998
  </fo:block>
5998
5999
  </fo:table-cell>
5999
6000
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -6057,6 +6058,8 @@
6057
6058
 
6058
6059
  <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"/> -->
6059
6060
 
6061
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
6062
+
6060
6063
  </fo:block>
6061
6064
  </fo:table-cell>
6062
6065
  </xsl:template> <!-- td -->
@@ -6128,7 +6131,8 @@
6128
6131
  </xsl:choose>
6129
6132
  </xsl:variable>
6130
6133
  <xsl:variable name="current_fn_number_text">
6131
- <xsl:value-of select="$current_fn_number"/>
6134
+
6135
+ <xsl:value-of select="$current_fn_number"/>
6132
6136
 
6133
6137
  </xsl:variable>
6134
6138
 
@@ -6164,8 +6168,10 @@
6164
6168
 
6165
6169
  <xsl:call-template name="insert_basic_link">
6166
6170
  <xsl:with-param name="element">
6167
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
6168
- <xsl:copy-of select="$current_fn_number_text"/>
6171
+ <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 -->
6172
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
6173
+ <xsl:copy-of select="$current_fn_number_text"/>
6174
+ </fo:inline>
6169
6175
  </fo:basic-link>
6170
6176
  </xsl:with-param>
6171
6177
  </xsl:call-template>
@@ -6452,7 +6458,7 @@
6452
6458
 
6453
6459
  <xsl:call-template name="refine_fn-reference-style"/>
6454
6460
 
6455
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6461
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6456
6462
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6457
6463
  <xsl:attribute name="internal-destination">
6458
6464
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -7496,9 +7502,19 @@
7496
7502
  </fo:inline>
7497
7503
  </xsl:template>
7498
7504
 
7499
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
7505
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
7506
+ <xsl:param name="txt"/>
7500
7507
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
7501
- <xsl:variable name="text" select="."/>
7508
+ <xsl:variable name="text">
7509
+ <xsl:choose>
7510
+ <xsl:when test="$txt != ''">
7511
+ <xsl:value-of select="$txt"/>
7512
+ </xsl:when>
7513
+ <xsl:otherwise>
7514
+ <xsl:value-of select="."/>
7515
+ </xsl:otherwise>
7516
+ </xsl:choose>
7517
+ </xsl:variable>
7502
7518
  <xsl:variable name="ratio_">
7503
7519
  0.75
7504
7520
  </xsl:variable>
@@ -8892,14 +8908,16 @@
8892
8908
  <xsl:template match="*[local-name()='link']" name="link">
8893
8909
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8894
8910
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8911
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
8895
8912
  <xsl:variable name="target">
8896
8913
  <xsl:choose>
8897
8914
  <xsl:when test="@updatetype = 'true'">
8898
8915
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8899
8916
  </xsl:when>
8900
8917
  <!-- link to the PDF attachment -->
8901
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8902
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8918
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
8919
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
8920
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
8903
8921
  </xsl:when>
8904
8922
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8905
8923
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -8930,6 +8948,11 @@
8930
8948
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8931
8949
  </xsl:if>
8932
8950
 
8951
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8952
+ <xsl:attribute name="color">inherit</xsl:attribute>
8953
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
8954
+ </xsl:if>
8955
+
8933
8956
  <xsl:call-template name="refine_link-style"/>
8934
8957
 
8935
8958
  <xsl:choose>
@@ -8937,9 +8960,15 @@
8937
8960
  <xsl:apply-templates/>
8938
8961
  </xsl:when>
8939
8962
  <xsl:otherwise>
8963
+ <xsl:variable name="alt_text">
8964
+ <xsl:call-template name="getAltText"/>
8965
+ </xsl:variable>
8940
8966
  <xsl:call-template name="insert_basic_link">
8941
8967
  <xsl:with-param name="element">
8942
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8968
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8969
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8970
+ <xsl:attribute name="role">Annot</xsl:attribute>
8971
+ </xsl:if>
8943
8972
  <xsl:choose>
8944
8973
  <xsl:when test="normalize-space(.) = ''">
8945
8974
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8952,6 +8981,10 @@
8952
8981
  </xsl:otherwise>
8953
8982
  </xsl:choose>
8954
8983
  </fo:basic-link>
8984
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8985
+ <!-- reserve space at right for PaperClip icon -->
8986
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8987
+ </xsl:if>
8955
8988
  </xsl:with-param>
8956
8989
  </xsl:call-template>
8957
8990
  </xsl:otherwise>
@@ -8959,6 +8992,14 @@
8959
8992
  </fo:inline>
8960
8993
  </xsl:template> <!-- link -->
8961
8994
 
8995
+ <xsl:template name="getAltText">
8996
+ <xsl:choose>
8997
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
8998
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
8999
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
9000
+ </xsl:choose>
9001
+ </xsl:template>
9002
+
8962
9003
  <!-- ======================== -->
8963
9004
  <!-- Appendix processing -->
8964
9005
  <!-- ======================== -->
@@ -8989,7 +9030,7 @@
8989
9030
  <xsl:template match="*[local-name() = 'callout']">
8990
9031
  <xsl:choose>
8991
9032
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8992
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
9033
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8993
9034
  </xsl:choose>
8994
9035
  </xsl:template>
8995
9036
 
@@ -9018,7 +9059,10 @@
9018
9059
  <xsl:template match="*[local-name() = 'xref']">
9019
9060
  <xsl:call-template name="insert_basic_link">
9020
9061
  <xsl:with-param name="element">
9021
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
9062
+ <xsl:variable name="alt_text">
9063
+ <xsl:call-template name="getAltText"/>
9064
+ </xsl:variable>
9065
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
9022
9066
  <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'])">
9023
9067
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9024
9068
  </xsl:if>
@@ -11506,12 +11550,14 @@
11506
11550
 
11507
11551
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
11508
11552
 
11509
- <xsl:variable name="provisional_distance_between_starts">
11553
+ <xsl:variable name="provisional_distance_between_starts_">
11510
11554
  7
11511
11555
  </xsl:variable>
11512
- <xsl:variable name="indent">
11556
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11557
+ <xsl:variable name="indent_">
11513
11558
  0
11514
11559
  </xsl:variable>
11560
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11515
11561
 
11516
11562
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11517
11563
  <fo:list-item>
@@ -12243,14 +12289,17 @@
12243
12289
  </xsl:when>
12244
12290
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12245
12291
 
12246
- <xsl:variable name="label">
12292
+ <xsl:variable name="type" select="../@type"/>
12247
12293
 
12248
- <xsl:variable name="type" select="../@type"/>
12294
+ <xsl:variable name="label">
12249
12295
 
12250
12296
  <xsl:variable name="style_prefix_">
12251
12297
  <xsl:if test="$type = 'roman'">
12252
12298
  <!-- Example: (i) -->
12253
12299
  </xsl:if>
12300
+ <xsl:if test="$type = 'alphabet'">
12301
+
12302
+ </xsl:if>
12254
12303
  </xsl:variable>
12255
12304
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
12256
12305
 
@@ -12276,13 +12325,15 @@
12276
12325
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
12277
12326
  <xsl:value-of select="$style_prefix"/>
12278
12327
  </xsl:if>
12328
+
12279
12329
  <xsl:value-of select="@label"/>
12330
+
12280
12331
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
12281
12332
  <xsl:value-of select="$style_suffix"/>
12282
12333
  </xsl:if>
12283
12334
  </xsl:variable>
12284
12335
 
12285
- <xsl:value-of select="normalize-space($label)"/>
12336
+ <xsl:value-of select="normalize-space($label)"/>
12286
12337
 
12287
12338
  </xsl:when>
12288
12339
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -14503,9 +14554,15 @@
14503
14554
  </x:xmpmeta>
14504
14555
  <!-- add attachments -->
14505
14556
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14506
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14507
-
14508
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14557
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
14558
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
14559
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14560
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14561
+ <!-- Todo: need update -->
14562
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14563
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14564
+
14565
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14509
14566
  <xsl:attribute name="src">
14510
14567
  <xsl:choose>
14511
14568
  <xsl:when test="normalize-space() != ''">
@@ -14521,18 +14578,34 @@
14521
14578
  <xsl:if test="$description != ''">
14522
14579
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14523
14580
  </xsl:if>
14581
+ <xsl:if test="$afrelationship != ''">
14582
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14583
+ </xsl:if>
14584
+ <xsl:if test="$volatile != ''">
14585
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14586
+ </xsl:if>
14524
14587
  </pdf:embedded-file>
14525
14588
  </xsl:for-each>
14526
14589
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14527
14590
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14528
14591
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14529
14592
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14593
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
14530
14594
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14531
14595
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14532
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14596
+ <!-- Todo: need update -->
14597
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14598
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14599
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14533
14600
  <xsl:if test="$description != ''">
14534
14601
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14535
14602
  </xsl:if>
14603
+ <xsl:if test="$afrelationship != ''">
14604
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14605
+ </xsl:if>
14606
+ <xsl:if test="$volatile != ''">
14607
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14608
+ </xsl:if>
14536
14609
  </pdf:embedded-file>
14537
14610
  </xsl:for-each>
14538
14611
  </xsl:if>
@@ -14552,6 +14625,12 @@
14552
14625
  <!-- Get or calculate depth of the element -->
14553
14626
  <xsl:template name="getLevel">
14554
14627
  <xsl:param name="depth"/>
14628
+ <!-- <xsl:message>
14629
+ <xsl:choose>
14630
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
14631
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
14632
+ </xsl:choose>
14633
+ </xsl:message> -->
14555
14634
  <xsl:choose>
14556
14635
  <xsl:when test="normalize-space(@depth) != ''">
14557
14636
  <xsl:value-of select="@depth"/>
@@ -14572,8 +14651,48 @@
14572
14651
  <xsl:when test="ancestor::*[local-name() = 'preface']">
14573
14652
  <xsl:value-of select="$level_total - 2"/>
14574
14653
  </xsl:when>
14654
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14655
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
14656
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
14657
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
14658
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
14659
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
14660
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
14661
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
14662
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
14663
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
14664
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
14665
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
14666
+ <xsl:choose>
14667
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
14668
+ <xsl:value-of select="number($curr_clause_depth)"/>
14669
+ </xsl:when>
14670
+ <xsl:otherwise>
14671
+ <xsl:value-of select="$level_total - 2"/>
14672
+ </xsl:otherwise>
14673
+ </xsl:choose>
14674
+ </xsl:when>
14675
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
14676
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14677
+ <xsl:choose>
14678
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
14679
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
14680
+ </xsl:when>
14681
+ <xsl:otherwise>
14682
+ <xsl:value-of select="$level_total - 2"/>
14683
+ </xsl:otherwise>
14684
+ </xsl:choose>
14685
+ </xsl:when>
14575
14686
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14576
- <xsl:value-of select="$level_total - 1"/>
14687
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14688
+ <xsl:choose>
14689
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14690
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14691
+ </xsl:when>
14692
+ <xsl:otherwise>
14693
+ <xsl:value-of select="$level_total - 1"/>
14694
+ </xsl:otherwise>
14695
+ </xsl:choose>
14577
14696
  </xsl:when>
14578
14697
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
14579
14698
  <xsl:value-of select="$level_total - 1"/>
@@ -14581,6 +14700,17 @@
14581
14700
  <xsl:when test="parent::*[local-name() = 'annex']">
14582
14701
  <xsl:value-of select="$level_total - 1"/>
14583
14702
  </xsl:when>
14703
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
14704
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14705
+ <xsl:choose>
14706
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14707
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14708
+ </xsl:when>
14709
+ <xsl:otherwise>
14710
+ <xsl:value-of select="$level_total - 1"/>
14711
+ </xsl:otherwise>
14712
+ </xsl:choose>
14713
+ </xsl:when>
14584
14714
  <xsl:when test="ancestor::*[local-name() = 'annex']">
14585
14715
  <xsl:value-of select="$level_total"/>
14586
14716
  </xsl:when>
@@ -14939,6 +15069,20 @@
14939
15069
 
14940
15070
  <!-- END: insert cover page image -->
14941
15071
 
15072
+ <xsl:template name="insertVerticalChar">
15073
+ <xsl:param name="str"/>
15074
+ <xsl:if test="string-length($str) &gt; 0">
15075
+ <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">
15076
+ <fo:block-container width="1em">
15077
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
15078
+ </fo:block-container>
15079
+ </fo:inline-container>
15080
+ <xsl:call-template name="insertVerticalChar">
15081
+ <xsl:with-param name="str" select="substring($str, 2)"/>
15082
+ </xsl:call-template>
15083
+ </xsl:if>
15084
+ </xsl:template>
15085
+
14942
15086
  <xsl:template name="number-to-words">
14943
15087
  <xsl:param name="number"/>
14944
15088
  <xsl:param name="first"/>
@@ -15226,4 +15370,18 @@
15226
15370
  </xsl:if>
15227
15371
  </xsl:template>
15228
15372
 
15373
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
15374
+ <xsl:copy>
15375
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
15376
+ </xsl:copy>
15377
+ </xsl:template>
15378
+
15379
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
15380
+ <xsl:copy>
15381
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
15382
+ <xsl:attribute name="role">SKIP</xsl:attribute>
15383
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
15384
+ </xsl:copy>
15385
+ </xsl:template>
15386
+
15229
15387
  </xsl:stylesheet>