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.
@@ -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)"/>
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module BIPM
2
+ module Bipm
3
3
  class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
4
4
  def doccontrol(doc)
5
5
  return unless doc.at(ns("//bibdata/relation[@type = 'supersedes']"))
@@ -4,7 +4,7 @@ require_relative "init"
4
4
  require_relative "base_convert"
5
5
 
6
6
  module IsoDoc
7
- module BIPM
7
+ module Bipm
8
8
  class HtmlConvert < IsoDoc::Generic::HtmlConvert
9
9
  def doccontrol(elem, out)
10
10
  out.div **attr_code(class: "doccontrol") do |div|
@@ -1,8 +1,8 @@
1
1
  module IsoDoc
2
- module BIPM
2
+ module Bipm
3
3
  class I18n < IsoDoc::Generic::I18n
4
4
  def configuration
5
- Metanorma::BIPM.configuration
5
+ Metanorma::Bipm.configuration
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@ require "twitter_cldr"
2
2
  require "sterile"
3
3
 
4
4
  module IsoDoc
5
- module BIPM
5
+ module Bipm
6
6
  class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
7
7
  def add_id
8
8
  %(id="_#{UUIDTools::UUID.random_create}")
@@ -4,7 +4,7 @@ require_relative "xref"
4
4
  require_relative "i18n"
5
5
 
6
6
  module IsoDoc
7
- module BIPM
7
+ module Bipm
8
8
  module Init
9
9
  def metadata_init(lang, script, locale, labels)
10
10
  @meta = Metadata.new(lang, script, locale, labels)
@@ -21,7 +21,7 @@ module IsoDoc
21
21
  end
22
22
 
23
23
  def bibrenderer(options = {})
24
- ::Relaton::Render::BIPM::General.new(options.merge(language: @lang,
24
+ ::Relaton::Render::Bipm::General.new(options.merge(language: @lang,
25
25
  i18nhash: @i18n.get))
26
26
  end
27
27