metanorma-ogc 2.6.3 → 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5383,7 +5383,8 @@
5383
5383
  </xsl:choose>
5384
5384
  </xsl:variable>
5385
5385
  <xsl:variable name="current_fn_number_text">
5386
- <xsl:value-of select="$current_fn_number"/>
5386
+
5387
+ <xsl:value-of select="$current_fn_number"/>
5387
5388
 
5388
5389
  </xsl:variable>
5389
5390
 
@@ -5419,8 +5420,10 @@
5419
5420
 
5420
5421
  <xsl:call-template name="insert_basic_link">
5421
5422
  <xsl:with-param name="element">
5422
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5423
- <xsl:copy-of select="$current_fn_number_text"/>
5423
+ <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 -->
5424
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5425
+ <xsl:copy-of select="$current_fn_number_text"/>
5426
+ </fo:inline>
5424
5427
  </fo:basic-link>
5425
5428
  </xsl:with-param>
5426
5429
  </xsl:call-template>
@@ -5707,7 +5710,7 @@
5707
5710
 
5708
5711
  <xsl:call-template name="refine_fn-reference-style"/>
5709
5712
 
5710
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5713
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5711
5714
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5712
5715
  <xsl:attribute name="internal-destination">
5713
5716
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6722,9 +6725,19 @@
6722
6725
  </fo:inline>
6723
6726
  </xsl:template>
6724
6727
 
6725
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6728
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6729
+ <xsl:param name="txt"/>
6726
6730
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6727
- <xsl:variable name="text" select="."/>
6731
+ <xsl:variable name="text">
6732
+ <xsl:choose>
6733
+ <xsl:when test="$txt != ''">
6734
+ <xsl:value-of select="$txt"/>
6735
+ </xsl:when>
6736
+ <xsl:otherwise>
6737
+ <xsl:value-of select="."/>
6738
+ </xsl:otherwise>
6739
+ </xsl:choose>
6740
+ </xsl:variable>
6728
6741
  <xsl:variable name="ratio_">
6729
6742
  0.75
6730
6743
  </xsl:variable>
@@ -8170,9 +8183,12 @@
8170
8183
  <xsl:apply-templates/>
8171
8184
  </xsl:when>
8172
8185
  <xsl:otherwise>
8186
+ <xsl:variable name="alt_text">
8187
+ <xsl:call-template name="getAltText"/>
8188
+ </xsl:variable>
8173
8189
  <xsl:call-template name="insert_basic_link">
8174
8190
  <xsl:with-param name="element">
8175
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8191
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8176
8192
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8177
8193
  <xsl:attribute name="role">Annot</xsl:attribute>
8178
8194
  </xsl:if>
@@ -8199,6 +8215,14 @@
8199
8215
  </fo:inline>
8200
8216
  </xsl:template> <!-- link -->
8201
8217
 
8218
+ <xsl:template name="getAltText">
8219
+ <xsl:choose>
8220
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
8221
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
8222
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
8223
+ </xsl:choose>
8224
+ </xsl:template>
8225
+
8202
8226
  <!-- ======================== -->
8203
8227
  <!-- Appendix processing -->
8204
8228
  <!-- ======================== -->
@@ -8229,7 +8253,7 @@
8229
8253
  <xsl:template match="*[local-name() = 'callout']">
8230
8254
  <xsl:choose>
8231
8255
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8232
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8256
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8233
8257
  </xsl:choose>
8234
8258
  </xsl:template>
8235
8259
 
@@ -8262,7 +8286,10 @@
8262
8286
  <xsl:template match="*[local-name() = 'xref']">
8263
8287
  <xsl:call-template name="insert_basic_link">
8264
8288
  <xsl:with-param name="element">
8265
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8289
+ <xsl:variable name="alt_text">
8290
+ <xsl:call-template name="getAltText"/>
8291
+ </xsl:variable>
8292
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
8266
8293
  <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'])">
8267
8294
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8268
8295
  </xsl:if>
@@ -10797,12 +10824,14 @@
10797
10824
 
10798
10825
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
10799
10826
 
10800
- <xsl:variable name="provisional_distance_between_starts">
10827
+ <xsl:variable name="provisional_distance_between_starts_">
10801
10828
  7
10802
10829
  </xsl:variable>
10803
- <xsl:variable name="indent">
10830
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10831
+ <xsl:variable name="indent_">
10804
10832
  0
10805
10833
  </xsl:variable>
10834
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10806
10835
 
10807
10836
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10808
10837
  <fo:list-item>
@@ -11524,14 +11553,17 @@
11524
11553
  </xsl:when>
11525
11554
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11526
11555
 
11527
- <xsl:variable name="label">
11556
+ <xsl:variable name="type" select="../@type"/>
11528
11557
 
11529
- <xsl:variable name="type" select="../@type"/>
11558
+ <xsl:variable name="label">
11530
11559
 
11531
11560
  <xsl:variable name="style_prefix_">
11532
11561
  <xsl:if test="$type = 'roman'">
11533
11562
  <!-- Example: (i) -->
11534
11563
  </xsl:if>
11564
+ <xsl:if test="$type = 'alphabet'">
11565
+
11566
+ </xsl:if>
11535
11567
  </xsl:variable>
11536
11568
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11537
11569
 
@@ -11557,13 +11589,15 @@
11557
11589
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11558
11590
  <xsl:value-of select="$style_prefix"/>
11559
11591
  </xsl:if>
11592
+
11560
11593
  <xsl:value-of select="@label"/>
11594
+
11561
11595
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11562
11596
  <xsl:value-of select="$style_suffix"/>
11563
11597
  </xsl:if>
11564
11598
  </xsl:variable>
11565
11599
 
11566
- <xsl:value-of select="normalize-space($label)"/>
11600
+ <xsl:value-of select="normalize-space($label)"/>
11567
11601
 
11568
11602
  </xsl:when>
11569
11603
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -13767,7 +13801,8 @@
13767
13801
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13768
13802
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13769
13803
  <!-- Todo: need update -->
13770
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13804
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13805
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13771
13806
 
13772
13807
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13773
13808
  <xsl:attribute name="src">
@@ -13788,6 +13823,9 @@
13788
13823
  <xsl:if test="$afrelationship != ''">
13789
13824
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13790
13825
  </xsl:if>
13826
+ <xsl:if test="$volatile != ''">
13827
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13828
+ </xsl:if>
13791
13829
  </pdf:embedded-file>
13792
13830
  </xsl:for-each>
13793
13831
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -13798,14 +13836,18 @@
13798
13836
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13799
13837
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13800
13838
  <!-- Todo: need update -->
13801
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13839
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13840
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13802
13841
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13803
13842
  <xsl:if test="$description != ''">
13804
13843
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13805
13844
  </xsl:if>
13806
13845
  <xsl:if test="$afrelationship != ''">
13807
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13808
- </xsl:if>
13846
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13847
+ </xsl:if>
13848
+ <xsl:if test="$volatile != ''">
13849
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13850
+ </xsl:if>
13809
13851
  </pdf:embedded-file>
13810
13852
  </xsl:for-each>
13811
13853
  </xsl:if>
@@ -13852,10 +13894,31 @@
13852
13894
  <xsl:value-of select="$level_total - 2"/>
13853
13895
  </xsl:when>
13854
13896
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13855
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13897
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
13898
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
13899
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
13900
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
13901
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
13902
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
13903
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
13904
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
13905
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
13906
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
13907
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
13856
13908
  <xsl:choose>
13857
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13858
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
13909
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
13910
+ <xsl:value-of select="number($curr_clause_depth)"/>
13911
+ </xsl:when>
13912
+ <xsl:otherwise>
13913
+ <xsl:value-of select="$level_total - 2"/>
13914
+ </xsl:otherwise>
13915
+ </xsl:choose>
13916
+ </xsl:when>
13917
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
13918
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13919
+ <xsl:choose>
13920
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
13921
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
13859
13922
  </xsl:when>
13860
13923
  <xsl:otherwise>
13861
13924
  <xsl:value-of select="$level_total - 2"/>
@@ -13863,7 +13926,7 @@
13863
13926
  </xsl:choose>
13864
13927
  </xsl:when>
13865
13928
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13866
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13929
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13867
13930
  <xsl:choose>
13868
13931
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13869
13932
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -5383,7 +5383,8 @@
5383
5383
  </xsl:choose>
5384
5384
  </xsl:variable>
5385
5385
  <xsl:variable name="current_fn_number_text">
5386
- <xsl:value-of select="$current_fn_number"/>
5386
+
5387
+ <xsl:value-of select="$current_fn_number"/>
5387
5388
 
5388
5389
  </xsl:variable>
5389
5390
 
@@ -5419,8 +5420,10 @@
5419
5420
 
5420
5421
  <xsl:call-template name="insert_basic_link">
5421
5422
  <xsl:with-param name="element">
5422
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5423
- <xsl:copy-of select="$current_fn_number_text"/>
5423
+ <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 -->
5424
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5425
+ <xsl:copy-of select="$current_fn_number_text"/>
5426
+ </fo:inline>
5424
5427
  </fo:basic-link>
5425
5428
  </xsl:with-param>
5426
5429
  </xsl:call-template>
@@ -5707,7 +5710,7 @@
5707
5710
 
5708
5711
  <xsl:call-template name="refine_fn-reference-style"/>
5709
5712
 
5710
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5713
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5711
5714
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5712
5715
  <xsl:attribute name="internal-destination">
5713
5716
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6722,9 +6725,19 @@
6722
6725
  </fo:inline>
6723
6726
  </xsl:template>
6724
6727
 
6725
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6728
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6729
+ <xsl:param name="txt"/>
6726
6730
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6727
- <xsl:variable name="text" select="."/>
6731
+ <xsl:variable name="text">
6732
+ <xsl:choose>
6733
+ <xsl:when test="$txt != ''">
6734
+ <xsl:value-of select="$txt"/>
6735
+ </xsl:when>
6736
+ <xsl:otherwise>
6737
+ <xsl:value-of select="."/>
6738
+ </xsl:otherwise>
6739
+ </xsl:choose>
6740
+ </xsl:variable>
6728
6741
  <xsl:variable name="ratio_">
6729
6742
  0.75
6730
6743
  </xsl:variable>
@@ -8170,9 +8183,12 @@
8170
8183
  <xsl:apply-templates/>
8171
8184
  </xsl:when>
8172
8185
  <xsl:otherwise>
8186
+ <xsl:variable name="alt_text">
8187
+ <xsl:call-template name="getAltText"/>
8188
+ </xsl:variable>
8173
8189
  <xsl:call-template name="insert_basic_link">
8174
8190
  <xsl:with-param name="element">
8175
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8191
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8176
8192
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8177
8193
  <xsl:attribute name="role">Annot</xsl:attribute>
8178
8194
  </xsl:if>
@@ -8199,6 +8215,14 @@
8199
8215
  </fo:inline>
8200
8216
  </xsl:template> <!-- link -->
8201
8217
 
8218
+ <xsl:template name="getAltText">
8219
+ <xsl:choose>
8220
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
8221
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
8222
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
8223
+ </xsl:choose>
8224
+ </xsl:template>
8225
+
8202
8226
  <!-- ======================== -->
8203
8227
  <!-- Appendix processing -->
8204
8228
  <!-- ======================== -->
@@ -8229,7 +8253,7 @@
8229
8253
  <xsl:template match="*[local-name() = 'callout']">
8230
8254
  <xsl:choose>
8231
8255
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8232
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8256
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8233
8257
  </xsl:choose>
8234
8258
  </xsl:template>
8235
8259
 
@@ -8262,7 +8286,10 @@
8262
8286
  <xsl:template match="*[local-name() = 'xref']">
8263
8287
  <xsl:call-template name="insert_basic_link">
8264
8288
  <xsl:with-param name="element">
8265
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8289
+ <xsl:variable name="alt_text">
8290
+ <xsl:call-template name="getAltText"/>
8291
+ </xsl:variable>
8292
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
8266
8293
  <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'])">
8267
8294
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8268
8295
  </xsl:if>
@@ -10797,12 +10824,14 @@
10797
10824
 
10798
10825
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
10799
10826
 
10800
- <xsl:variable name="provisional_distance_between_starts">
10827
+ <xsl:variable name="provisional_distance_between_starts_">
10801
10828
  7
10802
10829
  </xsl:variable>
10803
- <xsl:variable name="indent">
10830
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10831
+ <xsl:variable name="indent_">
10804
10832
  0
10805
10833
  </xsl:variable>
10834
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10806
10835
 
10807
10836
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10808
10837
  <fo:list-item>
@@ -11524,14 +11553,17 @@
11524
11553
  </xsl:when>
11525
11554
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11526
11555
 
11527
- <xsl:variable name="label">
11556
+ <xsl:variable name="type" select="../@type"/>
11528
11557
 
11529
- <xsl:variable name="type" select="../@type"/>
11558
+ <xsl:variable name="label">
11530
11559
 
11531
11560
  <xsl:variable name="style_prefix_">
11532
11561
  <xsl:if test="$type = 'roman'">
11533
11562
  <!-- Example: (i) -->
11534
11563
  </xsl:if>
11564
+ <xsl:if test="$type = 'alphabet'">
11565
+
11566
+ </xsl:if>
11535
11567
  </xsl:variable>
11536
11568
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11537
11569
 
@@ -11557,13 +11589,15 @@
11557
11589
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11558
11590
  <xsl:value-of select="$style_prefix"/>
11559
11591
  </xsl:if>
11592
+
11560
11593
  <xsl:value-of select="@label"/>
11594
+
11561
11595
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11562
11596
  <xsl:value-of select="$style_suffix"/>
11563
11597
  </xsl:if>
11564
11598
  </xsl:variable>
11565
11599
 
11566
- <xsl:value-of select="normalize-space($label)"/>
11600
+ <xsl:value-of select="normalize-space($label)"/>
11567
11601
 
11568
11602
  </xsl:when>
11569
11603
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -13767,7 +13801,8 @@
13767
13801
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13768
13802
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13769
13803
  <!-- Todo: need update -->
13770
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13804
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13805
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13771
13806
 
13772
13807
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13773
13808
  <xsl:attribute name="src">
@@ -13788,6 +13823,9 @@
13788
13823
  <xsl:if test="$afrelationship != ''">
13789
13824
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13790
13825
  </xsl:if>
13826
+ <xsl:if test="$volatile != ''">
13827
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13828
+ </xsl:if>
13791
13829
  </pdf:embedded-file>
13792
13830
  </xsl:for-each>
13793
13831
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -13798,14 +13836,18 @@
13798
13836
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13799
13837
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13800
13838
  <!-- Todo: need update -->
13801
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13839
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13840
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13802
13841
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13803
13842
  <xsl:if test="$description != ''">
13804
13843
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13805
13844
  </xsl:if>
13806
13845
  <xsl:if test="$afrelationship != ''">
13807
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13808
- </xsl:if>
13846
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13847
+ </xsl:if>
13848
+ <xsl:if test="$volatile != ''">
13849
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13850
+ </xsl:if>
13809
13851
  </pdf:embedded-file>
13810
13852
  </xsl:for-each>
13811
13853
  </xsl:if>
@@ -13852,10 +13894,31 @@
13852
13894
  <xsl:value-of select="$level_total - 2"/>
13853
13895
  </xsl:when>
13854
13896
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13855
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13897
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
13898
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
13899
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
13900
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
13901
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
13902
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
13903
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
13904
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
13905
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
13906
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
13907
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
13856
13908
  <xsl:choose>
13857
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13858
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
13909
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
13910
+ <xsl:value-of select="number($curr_clause_depth)"/>
13911
+ </xsl:when>
13912
+ <xsl:otherwise>
13913
+ <xsl:value-of select="$level_total - 2"/>
13914
+ </xsl:otherwise>
13915
+ </xsl:choose>
13916
+ </xsl:when>
13917
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
13918
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13919
+ <xsl:choose>
13920
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
13921
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
13859
13922
  </xsl:when>
13860
13923
  <xsl:otherwise>
13861
13924
  <xsl:value-of select="$level_total - 2"/>
@@ -13863,7 +13926,7 @@
13863
13926
  </xsl:choose>
13864
13927
  </xsl:when>
13865
13928
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13866
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13929
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13867
13930
  <xsl:choose>
13868
13931
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13869
13932
  <xsl:value-of select="number($upper_clause_depth + 1)"/>