metanorma-bipm 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c52281fc98b996d70d44bd915b20da1df312c9419cd33817b39a912cd0aa0ca
4
- data.tar.gz: ca09e324aeaf02933d6c3a8643943798a7197330ff2e63ab6ef3c8ddd45c24d1
3
+ metadata.gz: ee327f237eb974834aa08e30a8377060d464252f817649d3706a92fa6b7b37ba
4
+ data.tar.gz: d3b799388ebe8e53161960f16f8ca90fb6a1337521a68aa592296171614879f9
5
5
  SHA512:
6
- metadata.gz: 94d9053fb4294784ccb083df5d4c29af549d95deed8dfddcb718477c029d2ca0b6ff51dff984d9e95527c1acdde85ddca108f451fdf1ebc619433ab571b5fed3
7
- data.tar.gz: d77102ed026ef15fca586f611571f3d7deb75c77004823ff2a78d62d2f326f0a26b9dc8316f43ceca5dfd20ab7df69b07a7e2dfe967168e509a0772129295bc4
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 +
@@ -7287,7 +7287,8 @@
7287
7287
  </xsl:choose>
7288
7288
  </xsl:variable>
7289
7289
  <xsl:variable name="current_fn_number_text">
7290
- <xsl:value-of select="$current_fn_number"/>
7290
+
7291
+ <xsl:value-of select="$current_fn_number"/>
7291
7292
 
7292
7293
  </xsl:variable>
7293
7294
 
@@ -7323,8 +7324,10 @@
7323
7324
 
7324
7325
  <xsl:call-template name="insert_basic_link">
7325
7326
  <xsl:with-param name="element">
7326
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7327
- <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>
7328
7331
  </fo:basic-link>
7329
7332
  </xsl:with-param>
7330
7333
  </xsl:call-template>
@@ -7609,7 +7612,7 @@
7609
7612
 
7610
7613
  <xsl:call-template name="refine_fn-reference-style"/>
7611
7614
 
7612
- <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-->
7613
7616
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7614
7617
  <xsl:attribute name="internal-destination">
7615
7618
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8612,9 +8615,19 @@
8612
8615
  </fo:inline>
8613
8616
  </xsl:template>
8614
8617
 
8615
- <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"/>
8616
8620
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8617
- <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>
8618
8631
  <xsl:variable name="ratio_">
8619
8632
  0.75
8620
8633
  </xsl:variable>
@@ -10092,9 +10105,12 @@
10092
10105
  <xsl:apply-templates/>
10093
10106
  </xsl:when>
10094
10107
  <xsl:otherwise>
10108
+ <xsl:variable name="alt_text">
10109
+ <xsl:call-template name="getAltText"/>
10110
+ </xsl:variable>
10095
10111
  <xsl:call-template name="insert_basic_link">
10096
10112
  <xsl:with-param name="element">
10097
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10113
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
10098
10114
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10099
10115
  <xsl:attribute name="role">Annot</xsl:attribute>
10100
10116
  </xsl:if>
@@ -10121,6 +10137,14 @@
10121
10137
  </fo:inline>
10122
10138
  </xsl:template> <!-- link -->
10123
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
+
10124
10148
  <!-- ======================== -->
10125
10149
  <!-- Appendix processing -->
10126
10150
  <!-- ======================== -->
@@ -10151,7 +10175,7 @@
10151
10175
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10152
10176
  <xsl:choose>
10153
10177
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10154
- <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>
10155
10179
  </xsl:choose>
10156
10180
  </xsl:template>
10157
10181
 
@@ -10180,7 +10204,10 @@
10180
10204
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10181
10205
  <xsl:call-template name="insert_basic_link">
10182
10206
  <xsl:with-param name="element">
10183
- <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">
10184
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'])">
10185
10212
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10186
10213
  </xsl:if>
@@ -12693,12 +12720,14 @@
12693
12720
 
12694
12721
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12695
12722
 
12696
- <xsl:variable name="provisional_distance_between_starts">
12723
+ <xsl:variable name="provisional_distance_between_starts_">
12697
12724
  7
12698
12725
  </xsl:variable>
12699
- <xsl:variable name="indent">
12726
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12727
+ <xsl:variable name="indent_">
12700
12728
  0
12701
12729
  </xsl:variable>
12730
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12702
12731
 
12703
12732
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12704
12733
  <fo:list-item>
@@ -13427,14 +13456,17 @@
13427
13456
  </xsl:when>
13428
13457
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13429
13458
 
13430
- <xsl:variable name="label">
13459
+ <xsl:variable name="type" select="../@type"/>
13431
13460
 
13432
- <xsl:variable name="type" select="../@type"/>
13461
+ <xsl:variable name="label">
13433
13462
 
13434
13463
  <xsl:variable name="style_prefix_">
13435
13464
  <xsl:if test="$type = 'roman'">
13436
13465
  ( <!-- Example: (i) -->
13437
13466
  </xsl:if>
13467
+ <xsl:if test="$type = 'alphabet'">
13468
+
13469
+ </xsl:if>
13438
13470
  </xsl:variable>
13439
13471
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13440
13472
 
@@ -13460,13 +13492,15 @@
13460
13492
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13461
13493
  <xsl:value-of select="$style_prefix"/>
13462
13494
  </xsl:if>
13495
+
13463
13496
  <xsl:value-of select="@label"/>
13497
+
13464
13498
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13465
13499
  <xsl:value-of select="$style_suffix"/>
13466
13500
  </xsl:if>
13467
13501
  </xsl:variable>
13468
13502
 
13469
- <xsl:value-of select="normalize-space($label)"/>
13503
+ <xsl:value-of select="normalize-space($label)"/>
13470
13504
 
13471
13505
  </xsl:when>
13472
13506
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15664,7 +15698,8 @@
15664
15698
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15665
15699
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15666
15700
  <!-- Todo: need update -->
15667
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
15668
15703
 
15669
15704
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15670
15705
  <xsl:attribute name="src">
@@ -15685,6 +15720,9 @@
15685
15720
  <xsl:if test="$afrelationship != ''">
15686
15721
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15687
15722
  </xsl:if>
15723
+ <xsl:if test="$volatile != ''">
15724
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15725
+ </xsl:if>
15688
15726
  </pdf:embedded-file>
15689
15727
  </xsl:for-each>
15690
15728
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -15695,14 +15733,18 @@
15695
15733
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15696
15734
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15697
15735
  <!-- Todo: need update -->
15698
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
15699
15738
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15700
15739
  <xsl:if test="$description != ''">
15701
15740
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15702
15741
  </xsl:if>
15703
15742
  <xsl:if test="$afrelationship != ''">
15704
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15705
- </xsl:if>
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>
15706
15748
  </pdf:embedded-file>
15707
15749
  </xsl:for-each>
15708
15750
  </xsl:if>
@@ -15749,10 +15791,31 @@
15749
15791
  <xsl:value-of select="$level_total - 2"/>
15750
15792
  </xsl:when>
15751
15793
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15752
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
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> -->
15753
15805
  <xsl:choose>
15754
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15755
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
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)"/>
15756
15819
  </xsl:when>
15757
15820
  <xsl:otherwise>
15758
15821
  <xsl:value-of select="$level_total - 2"/>
@@ -15760,7 +15823,7 @@
15760
15823
  </xsl:choose>
15761
15824
  </xsl:when>
15762
15825
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15763
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15826
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15764
15827
  <xsl:choose>
15765
15828
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15766
15829
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -7287,7 +7287,8 @@
7287
7287
  </xsl:choose>
7288
7288
  </xsl:variable>
7289
7289
  <xsl:variable name="current_fn_number_text">
7290
- <xsl:value-of select="$current_fn_number"/>
7290
+
7291
+ <xsl:value-of select="$current_fn_number"/>
7291
7292
 
7292
7293
  </xsl:variable>
7293
7294
 
@@ -7323,8 +7324,10 @@
7323
7324
 
7324
7325
  <xsl:call-template name="insert_basic_link">
7325
7326
  <xsl:with-param name="element">
7326
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7327
- <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>
7328
7331
  </fo:basic-link>
7329
7332
  </xsl:with-param>
7330
7333
  </xsl:call-template>
@@ -7609,7 +7612,7 @@
7609
7612
 
7610
7613
  <xsl:call-template name="refine_fn-reference-style"/>
7611
7614
 
7612
- <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-->
7613
7616
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7614
7617
  <xsl:attribute name="internal-destination">
7615
7618
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8612,9 +8615,19 @@
8612
8615
  </fo:inline>
8613
8616
  </xsl:template>
8614
8617
 
8615
- <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"/>
8616
8620
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8617
- <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>
8618
8631
  <xsl:variable name="ratio_">
8619
8632
  0.75
8620
8633
  </xsl:variable>
@@ -10092,9 +10105,12 @@
10092
10105
  <xsl:apply-templates/>
10093
10106
  </xsl:when>
10094
10107
  <xsl:otherwise>
10108
+ <xsl:variable name="alt_text">
10109
+ <xsl:call-template name="getAltText"/>
10110
+ </xsl:variable>
10095
10111
  <xsl:call-template name="insert_basic_link">
10096
10112
  <xsl:with-param name="element">
10097
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10113
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
10098
10114
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10099
10115
  <xsl:attribute name="role">Annot</xsl:attribute>
10100
10116
  </xsl:if>
@@ -10121,6 +10137,14 @@
10121
10137
  </fo:inline>
10122
10138
  </xsl:template> <!-- link -->
10123
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
+
10124
10148
  <!-- ======================== -->
10125
10149
  <!-- Appendix processing -->
10126
10150
  <!-- ======================== -->
@@ -10151,7 +10175,7 @@
10151
10175
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10152
10176
  <xsl:choose>
10153
10177
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10154
- <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>
10155
10179
  </xsl:choose>
10156
10180
  </xsl:template>
10157
10181
 
@@ -10180,7 +10204,10 @@
10180
10204
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10181
10205
  <xsl:call-template name="insert_basic_link">
10182
10206
  <xsl:with-param name="element">
10183
- <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">
10184
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'])">
10185
10212
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10186
10213
  </xsl:if>
@@ -12693,12 +12720,14 @@
12693
12720
 
12694
12721
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12695
12722
 
12696
- <xsl:variable name="provisional_distance_between_starts">
12723
+ <xsl:variable name="provisional_distance_between_starts_">
12697
12724
  7
12698
12725
  </xsl:variable>
12699
- <xsl:variable name="indent">
12726
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12727
+ <xsl:variable name="indent_">
12700
12728
  0
12701
12729
  </xsl:variable>
12730
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12702
12731
 
12703
12732
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12704
12733
  <fo:list-item>
@@ -13427,14 +13456,17 @@
13427
13456
  </xsl:when>
13428
13457
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13429
13458
 
13430
- <xsl:variable name="label">
13459
+ <xsl:variable name="type" select="../@type"/>
13431
13460
 
13432
- <xsl:variable name="type" select="../@type"/>
13461
+ <xsl:variable name="label">
13433
13462
 
13434
13463
  <xsl:variable name="style_prefix_">
13435
13464
  <xsl:if test="$type = 'roman'">
13436
13465
  ( <!-- Example: (i) -->
13437
13466
  </xsl:if>
13467
+ <xsl:if test="$type = 'alphabet'">
13468
+
13469
+ </xsl:if>
13438
13470
  </xsl:variable>
13439
13471
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13440
13472
 
@@ -13460,13 +13492,15 @@
13460
13492
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13461
13493
  <xsl:value-of select="$style_prefix"/>
13462
13494
  </xsl:if>
13495
+
13463
13496
  <xsl:value-of select="@label"/>
13497
+
13464
13498
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13465
13499
  <xsl:value-of select="$style_suffix"/>
13466
13500
  </xsl:if>
13467
13501
  </xsl:variable>
13468
13502
 
13469
- <xsl:value-of select="normalize-space($label)"/>
13503
+ <xsl:value-of select="normalize-space($label)"/>
13470
13504
 
13471
13505
  </xsl:when>
13472
13506
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15664,7 +15698,8 @@
15664
15698
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15665
15699
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15666
15700
  <!-- Todo: need update -->
15667
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
15668
15703
 
15669
15704
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15670
15705
  <xsl:attribute name="src">
@@ -15685,6 +15720,9 @@
15685
15720
  <xsl:if test="$afrelationship != ''">
15686
15721
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15687
15722
  </xsl:if>
15723
+ <xsl:if test="$volatile != ''">
15724
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15725
+ </xsl:if>
15688
15726
  </pdf:embedded-file>
15689
15727
  </xsl:for-each>
15690
15728
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -15695,14 +15733,18 @@
15695
15733
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15696
15734
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15697
15735
  <!-- Todo: need update -->
15698
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
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'])"/>
15699
15738
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15700
15739
  <xsl:if test="$description != ''">
15701
15740
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15702
15741
  </xsl:if>
15703
15742
  <xsl:if test="$afrelationship != ''">
15704
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15705
- </xsl:if>
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>
15706
15748
  </pdf:embedded-file>
15707
15749
  </xsl:for-each>
15708
15750
  </xsl:if>
@@ -15749,10 +15791,31 @@
15749
15791
  <xsl:value-of select="$level_total - 2"/>
15750
15792
  </xsl:when>
15751
15793
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15752
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
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> -->
15753
15805
  <xsl:choose>
15754
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15755
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
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)"/>
15756
15819
  </xsl:when>
15757
15820
  <xsl:otherwise>
15758
15821
  <xsl:value-of select="$level_total - 2"/>
@@ -15760,7 +15823,7 @@
15760
15823
  </xsl:choose>
15761
15824
  </xsl:when>
15762
15825
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15763
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15826
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15764
15827
  <xsl:choose>
15765
15828
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15766
15829
  <xsl:value-of select="number($upper_clause_depth + 1)"/>