metanorma-itu 2.5.4 → 2.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) 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_convert.rb +1 -1
  5. data/lib/isodoc/itu/i18n.rb +1 -1
  6. data/lib/isodoc/itu/init.rb +2 -2
  7. data/lib/isodoc/itu/itu.implementers-guide.xsl +85 -22
  8. data/lib/isodoc/itu/itu.in-force.xsl +85 -22
  9. data/lib/isodoc/itu/itu.recommendation-annex.xsl +85 -22
  10. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +85 -22
  11. data/lib/isodoc/itu/itu.recommendation.xsl +85 -22
  12. data/lib/isodoc/itu/itu.resolution.xsl +85 -22
  13. data/lib/isodoc/itu/itu.service-publication.xsl +85 -22
  14. data/lib/isodoc/itu/itu.technical-paper.xsl +85 -22
  15. data/lib/isodoc/itu/itu.technical-report.xsl +85 -22
  16. data/lib/isodoc/itu/metadata.rb +2 -2
  17. data/lib/isodoc/itu/metadata_date.rb +1 -1
  18. data/lib/isodoc/itu/pdf_convert.rb +1 -1
  19. data/lib/isodoc/itu/presentation_bibdata.rb +1 -1
  20. data/lib/isodoc/itu/presentation_contribution.rb +1 -1
  21. data/lib/isodoc/itu/presentation_preface.rb +1 -1
  22. data/lib/isodoc/itu/presentation_ref.rb +1 -1
  23. data/lib/isodoc/itu/presentation_xml_convert.rb +1 -1
  24. data/lib/isodoc/itu/ref.rb +1 -1
  25. data/lib/isodoc/itu/terms.rb +1 -1
  26. data/lib/isodoc/itu/word_cleanup.rb +1 -1
  27. data/lib/isodoc/itu/word_convert.rb +1 -1
  28. data/lib/isodoc/itu/xref.rb +1 -1
  29. data/lib/isodoc/itu/xref_section.rb +1 -1
  30. data/lib/isodoc/itu.rb +1 -1
  31. data/lib/metanorma/itu/biblio-standoc.rng +13 -0
  32. data/lib/metanorma/itu/biblio.rng +19 -12
  33. data/lib/metanorma/itu/cleanup.rb +1 -1
  34. data/lib/metanorma/itu/cleanup_section.rb +1 -1
  35. data/lib/metanorma/itu/converter.rb +6 -6
  36. data/lib/metanorma/itu/front.rb +2 -1
  37. data/lib/metanorma/itu/front_id.rb +1 -1
  38. data/lib/metanorma/itu/processor.rb +6 -6
  39. data/lib/metanorma/itu/relaton-itu.rng +1 -0
  40. data/lib/metanorma/itu/validate.rb +1 -1
  41. data/lib/metanorma/itu/version.rb +2 -2
  42. data/lib/metanorma/itu.rb +1 -1
  43. data/lib/metanorma-itu.rb +1 -1
  44. data/lib/relaton/render/general.rb +2 -2
  45. data/lib/relaton/render/parse.rb +1 -1
  46. data/metanorma-itu.gemspec +1 -1
  47. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeef499368ee7c6a53777c5b7a78b0bcd330532814beceb0ea34704ec58d1c8c
4
- data.tar.gz: 52f881e446af35c9c55e5947d5379e38d2235b42ae51cb43cc776113bfd9d335
3
+ metadata.gz: a3261c835429196306df6cfaa35a3fecf9648b1449e13290290ae9db79d50a29
4
+ data.tar.gz: e5244715d2863c296587a45b7189ccce5f26c0efadcb841593c723b3eb376a95
5
5
  SHA512:
6
- metadata.gz: ab4bbdb14b34bee6212dffad59eb9a81d73273b2ef74e5472d658bc8b7ec8fabfe8213dad40a081839088c7012d0dce3e8ba3358e7a38e10c6be8411434d0090
7
- data.tar.gz: 8babf0fa94d31feb0bad1d441e69454afb15a48e72b93ee8934f45ccbac757eb64f2121e7161d6910a0ad563f8f8b2e562c1c466966057130fa3e1dbdd3fe7b2
6
+ metadata.gz: 8b6b7b3e5f5e8ca6ac9ceb724f3734454d695d9c9810ec41f10afcae9b7be583b35b31a9d6845650fbaec30725a7c0bbfc86bcc43c9c802e5758644303a551ae
7
+ data.tar.gz: 36884c6bade781e001e32a614d7d0f6e3d7aaf2fabd625ea398fa631e2f6a963b5ad30d575ef66ec45c86a4638f241c8c12431d25190c8631f4c8e51cca4b388
@@ -6,7 +6,7 @@ require_relative "terms"
6
6
  require_relative "cleanup"
7
7
 
8
8
  module IsoDoc
9
- module ITU
9
+ module Itu
10
10
  module BaseConvert
11
11
  FRONT_CLAUSE = "//*[parent::preface]" \
12
12
  "[not(local-name() = 'abstract')]".freeze
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  module BaseConvert
4
4
  def cleanup(docxml)
5
5
  super
@@ -3,7 +3,7 @@ require_relative "init"
3
3
  require "fileutils"
4
4
 
5
5
  module IsoDoc
6
- module ITU
6
+ module Itu
7
7
  # A {Converter} implementation that generates HTML output, and a document
8
8
  # schema encapsulation of the document for validation
9
9
  #
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module ITU
2
+ module Itu
3
3
  class I18n < IsoDoc::I18n
4
4
  def load_file(fname)
5
5
  f = File.join(File.dirname(__FILE__), fname)
@@ -4,7 +4,7 @@ require_relative "xref"
4
4
  require_relative "i18n"
5
5
 
6
6
  module IsoDoc
7
- module ITU
7
+ module Itu
8
8
  module Init
9
9
  def metadata_init(lang, script, locale, i18n)
10
10
  @meta = Metadata.new(lang, script, locale, i18n)
@@ -22,7 +22,7 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def bibrenderer(options = {})
25
- ::Relaton::Render::ITU::General.new(options.merge(language: @lang,
25
+ ::Relaton::Render::Itu::General.new(options.merge(language: @lang,
26
26
  i18nhash: @i18n.get))
27
27
  end
28
28
 
@@ -6131,7 +6131,8 @@
6131
6131
  </xsl:choose>
6132
6132
  </xsl:variable>
6133
6133
  <xsl:variable name="current_fn_number_text">
6134
- <xsl:value-of select="$current_fn_number"/>
6134
+
6135
+ <xsl:value-of select="$current_fn_number"/>
6135
6136
 
6136
6137
  </xsl:variable>
6137
6138
 
@@ -6167,8 +6168,10 @@
6167
6168
 
6168
6169
  <xsl:call-template name="insert_basic_link">
6169
6170
  <xsl:with-param name="element">
6170
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
6171
- <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>
6172
6175
  </fo:basic-link>
6173
6176
  </xsl:with-param>
6174
6177
  </xsl:call-template>
@@ -6455,7 +6458,7 @@
6455
6458
 
6456
6459
  <xsl:call-template name="refine_fn-reference-style"/>
6457
6460
 
6458
- <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-->
6459
6462
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6460
6463
  <xsl:attribute name="internal-destination">
6461
6464
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -7499,9 +7502,19 @@
7499
7502
  </fo:inline>
7500
7503
  </xsl:template>
7501
7504
 
7502
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
7505
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
7506
+ <xsl:param name="txt"/>
7503
7507
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
7504
- <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>
7505
7518
  <xsl:variable name="ratio_">
7506
7519
  0.75
7507
7520
  </xsl:variable>
@@ -8947,9 +8960,12 @@
8947
8960
  <xsl:apply-templates/>
8948
8961
  </xsl:when>
8949
8962
  <xsl:otherwise>
8963
+ <xsl:variable name="alt_text">
8964
+ <xsl:call-template name="getAltText"/>
8965
+ </xsl:variable>
8950
8966
  <xsl:call-template name="insert_basic_link">
8951
8967
  <xsl:with-param name="element">
8952
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8968
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8953
8969
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8954
8970
  <xsl:attribute name="role">Annot</xsl:attribute>
8955
8971
  </xsl:if>
@@ -8976,6 +8992,14 @@
8976
8992
  </fo:inline>
8977
8993
  </xsl:template> <!-- link -->
8978
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
+
8979
9003
  <!-- ======================== -->
8980
9004
  <!-- Appendix processing -->
8981
9005
  <!-- ======================== -->
@@ -9006,7 +9030,7 @@
9006
9030
  <xsl:template match="*[local-name() = 'callout']">
9007
9031
  <xsl:choose>
9008
9032
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
9009
- <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>
9010
9034
  </xsl:choose>
9011
9035
  </xsl:template>
9012
9036
 
@@ -9035,7 +9059,10 @@
9035
9059
  <xsl:template match="*[local-name() = 'xref']">
9036
9060
  <xsl:call-template name="insert_basic_link">
9037
9061
  <xsl:with-param name="element">
9038
- <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">
9039
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'])">
9040
9067
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9041
9068
  </xsl:if>
@@ -11523,12 +11550,14 @@
11523
11550
 
11524
11551
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
11525
11552
 
11526
- <xsl:variable name="provisional_distance_between_starts">
11553
+ <xsl:variable name="provisional_distance_between_starts_">
11527
11554
  7
11528
11555
  </xsl:variable>
11529
- <xsl:variable name="indent">
11556
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11557
+ <xsl:variable name="indent_">
11530
11558
  0
11531
11559
  </xsl:variable>
11560
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11532
11561
 
11533
11562
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11534
11563
  <fo:list-item>
@@ -12260,14 +12289,17 @@
12260
12289
  </xsl:when>
12261
12290
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12262
12291
 
12263
- <xsl:variable name="label">
12292
+ <xsl:variable name="type" select="../@type"/>
12264
12293
 
12265
- <xsl:variable name="type" select="../@type"/>
12294
+ <xsl:variable name="label">
12266
12295
 
12267
12296
  <xsl:variable name="style_prefix_">
12268
12297
  <xsl:if test="$type = 'roman'">
12269
12298
  <!-- Example: (i) -->
12270
12299
  </xsl:if>
12300
+ <xsl:if test="$type = 'alphabet'">
12301
+
12302
+ </xsl:if>
12271
12303
  </xsl:variable>
12272
12304
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
12273
12305
 
@@ -12293,13 +12325,15 @@
12293
12325
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
12294
12326
  <xsl:value-of select="$style_prefix"/>
12295
12327
  </xsl:if>
12328
+
12296
12329
  <xsl:value-of select="@label"/>
12330
+
12297
12331
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
12298
12332
  <xsl:value-of select="$style_suffix"/>
12299
12333
  </xsl:if>
12300
12334
  </xsl:variable>
12301
12335
 
12302
- <xsl:value-of select="normalize-space($label)"/>
12336
+ <xsl:value-of select="normalize-space($label)"/>
12303
12337
 
12304
12338
  </xsl:when>
12305
12339
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -14525,7 +14559,8 @@
14525
14559
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14526
14560
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14527
14561
  <!-- Todo: need update -->
14528
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
14529
14564
 
14530
14565
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14531
14566
  <xsl:attribute name="src">
@@ -14546,6 +14581,9 @@
14546
14581
  <xsl:if test="$afrelationship != ''">
14547
14582
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14548
14583
  </xsl:if>
14584
+ <xsl:if test="$volatile != ''">
14585
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14586
+ </xsl:if>
14549
14587
  </pdf:embedded-file>
14550
14588
  </xsl:for-each>
14551
14589
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -14556,14 +14594,18 @@
14556
14594
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14557
14595
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14558
14596
  <!-- Todo: need update -->
14559
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
14560
14599
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14561
14600
  <xsl:if test="$description != ''">
14562
14601
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14563
14602
  </xsl:if>
14564
14603
  <xsl:if test="$afrelationship != ''">
14565
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14566
- </xsl:if>
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>
14567
14609
  </pdf:embedded-file>
14568
14610
  </xsl:for-each>
14569
14611
  </xsl:if>
@@ -14610,10 +14652,31 @@
14610
14652
  <xsl:value-of select="$level_total - 2"/>
14611
14653
  </xsl:when>
14612
14654
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14613
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
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> -->
14614
14666
  <xsl:choose>
14615
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14616
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
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)"/>
14617
14680
  </xsl:when>
14618
14681
  <xsl:otherwise>
14619
14682
  <xsl:value-of select="$level_total - 2"/>
@@ -14621,7 +14684,7 @@
14621
14684
  </xsl:choose>
14622
14685
  </xsl:when>
14623
14686
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14624
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14687
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14625
14688
  <xsl:choose>
14626
14689
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14627
14690
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -6131,7 +6131,8 @@
6131
6131
  </xsl:choose>
6132
6132
  </xsl:variable>
6133
6133
  <xsl:variable name="current_fn_number_text">
6134
- <xsl:value-of select="$current_fn_number"/>
6134
+
6135
+ <xsl:value-of select="$current_fn_number"/>
6135
6136
 
6136
6137
  </xsl:variable>
6137
6138
 
@@ -6167,8 +6168,10 @@
6167
6168
 
6168
6169
  <xsl:call-template name="insert_basic_link">
6169
6170
  <xsl:with-param name="element">
6170
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
6171
- <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>
6172
6175
  </fo:basic-link>
6173
6176
  </xsl:with-param>
6174
6177
  </xsl:call-template>
@@ -6455,7 +6458,7 @@
6455
6458
 
6456
6459
  <xsl:call-template name="refine_fn-reference-style"/>
6457
6460
 
6458
- <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-->
6459
6462
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6460
6463
  <xsl:attribute name="internal-destination">
6461
6464
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -7499,9 +7502,19 @@
7499
7502
  </fo:inline>
7500
7503
  </xsl:template>
7501
7504
 
7502
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
7505
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
7506
+ <xsl:param name="txt"/>
7503
7507
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
7504
- <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>
7505
7518
  <xsl:variable name="ratio_">
7506
7519
  0.75
7507
7520
  </xsl:variable>
@@ -8947,9 +8960,12 @@
8947
8960
  <xsl:apply-templates/>
8948
8961
  </xsl:when>
8949
8962
  <xsl:otherwise>
8963
+ <xsl:variable name="alt_text">
8964
+ <xsl:call-template name="getAltText"/>
8965
+ </xsl:variable>
8950
8966
  <xsl:call-template name="insert_basic_link">
8951
8967
  <xsl:with-param name="element">
8952
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8968
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8953
8969
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8954
8970
  <xsl:attribute name="role">Annot</xsl:attribute>
8955
8971
  </xsl:if>
@@ -8976,6 +8992,14 @@
8976
8992
  </fo:inline>
8977
8993
  </xsl:template> <!-- link -->
8978
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
+
8979
9003
  <!-- ======================== -->
8980
9004
  <!-- Appendix processing -->
8981
9005
  <!-- ======================== -->
@@ -9006,7 +9030,7 @@
9006
9030
  <xsl:template match="*[local-name() = 'callout']">
9007
9031
  <xsl:choose>
9008
9032
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
9009
- <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>
9010
9034
  </xsl:choose>
9011
9035
  </xsl:template>
9012
9036
 
@@ -9035,7 +9059,10 @@
9035
9059
  <xsl:template match="*[local-name() = 'xref']">
9036
9060
  <xsl:call-template name="insert_basic_link">
9037
9061
  <xsl:with-param name="element">
9038
- <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">
9039
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'])">
9040
9067
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9041
9068
  </xsl:if>
@@ -11523,12 +11550,14 @@
11523
11550
 
11524
11551
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
11525
11552
 
11526
- <xsl:variable name="provisional_distance_between_starts">
11553
+ <xsl:variable name="provisional_distance_between_starts_">
11527
11554
  7
11528
11555
  </xsl:variable>
11529
- <xsl:variable name="indent">
11556
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11557
+ <xsl:variable name="indent_">
11530
11558
  0
11531
11559
  </xsl:variable>
11560
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11532
11561
 
11533
11562
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11534
11563
  <fo:list-item>
@@ -12260,14 +12289,17 @@
12260
12289
  </xsl:when>
12261
12290
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12262
12291
 
12263
- <xsl:variable name="label">
12292
+ <xsl:variable name="type" select="../@type"/>
12264
12293
 
12265
- <xsl:variable name="type" select="../@type"/>
12294
+ <xsl:variable name="label">
12266
12295
 
12267
12296
  <xsl:variable name="style_prefix_">
12268
12297
  <xsl:if test="$type = 'roman'">
12269
12298
  <!-- Example: (i) -->
12270
12299
  </xsl:if>
12300
+ <xsl:if test="$type = 'alphabet'">
12301
+
12302
+ </xsl:if>
12271
12303
  </xsl:variable>
12272
12304
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
12273
12305
 
@@ -12293,13 +12325,15 @@
12293
12325
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
12294
12326
  <xsl:value-of select="$style_prefix"/>
12295
12327
  </xsl:if>
12328
+
12296
12329
  <xsl:value-of select="@label"/>
12330
+
12297
12331
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
12298
12332
  <xsl:value-of select="$style_suffix"/>
12299
12333
  </xsl:if>
12300
12334
  </xsl:variable>
12301
12335
 
12302
- <xsl:value-of select="normalize-space($label)"/>
12336
+ <xsl:value-of select="normalize-space($label)"/>
12303
12337
 
12304
12338
  </xsl:when>
12305
12339
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -14525,7 +14559,8 @@
14525
14559
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14526
14560
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14527
14561
  <!-- Todo: need update -->
14528
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
14529
14564
 
14530
14565
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14531
14566
  <xsl:attribute name="src">
@@ -14546,6 +14581,9 @@
14546
14581
  <xsl:if test="$afrelationship != ''">
14547
14582
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14548
14583
  </xsl:if>
14584
+ <xsl:if test="$volatile != ''">
14585
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14586
+ </xsl:if>
14549
14587
  </pdf:embedded-file>
14550
14588
  </xsl:for-each>
14551
14589
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -14556,14 +14594,18 @@
14556
14594
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14557
14595
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14558
14596
  <!-- Todo: need update -->
14559
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
14560
14599
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14561
14600
  <xsl:if test="$description != ''">
14562
14601
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14563
14602
  </xsl:if>
14564
14603
  <xsl:if test="$afrelationship != ''">
14565
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14566
- </xsl:if>
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>
14567
14609
  </pdf:embedded-file>
14568
14610
  </xsl:for-each>
14569
14611
  </xsl:if>
@@ -14610,10 +14652,31 @@
14610
14652
  <xsl:value-of select="$level_total - 2"/>
14611
14653
  </xsl:when>
14612
14654
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14613
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
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> -->
14614
14666
  <xsl:choose>
14615
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14616
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
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)"/>
14617
14680
  </xsl:when>
14618
14681
  <xsl:otherwise>
14619
14682
  <xsl:value-of select="$level_total - 2"/>
@@ -14621,7 +14684,7 @@
14621
14684
  </xsl:choose>
14622
14685
  </xsl:when>
14623
14686
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14624
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14687
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14625
14688
  <xsl:choose>
14626
14689
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14627
14690
  <xsl:value-of select="number($upper_clause_depth + 1)"/>