metanorma-itu 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5994,6 +5994,7 @@
5994
5994
 
5995
5995
  <fo:block role="SKIP">
5996
5996
  <xsl:apply-templates/>
5997
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5997
5998
  </fo:block>
5998
5999
  </fo:table-cell>
5999
6000
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -6057,6 +6058,8 @@
6057
6058
 
6058
6059
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
6059
6060
 
6061
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
6062
+
6060
6063
  </fo:block>
6061
6064
  </fo:table-cell>
6062
6065
  </xsl:template> <!-- td -->
@@ -8892,14 +8895,16 @@
8892
8895
  <xsl:template match="*[local-name()='link']" name="link">
8893
8896
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8894
8897
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8898
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
8895
8899
  <xsl:variable name="target">
8896
8900
  <xsl:choose>
8897
8901
  <xsl:when test="@updatetype = 'true'">
8898
8902
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8899
8903
  </xsl:when>
8900
8904
  <!-- link to the PDF attachment -->
8901
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8902
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8905
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
8906
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
8907
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
8903
8908
  </xsl:when>
8904
8909
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8905
8910
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -8930,6 +8935,11 @@
8930
8935
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8931
8936
  </xsl:if>
8932
8937
 
8938
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8939
+ <xsl:attribute name="color">inherit</xsl:attribute>
8940
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
8941
+ </xsl:if>
8942
+
8933
8943
  <xsl:call-template name="refine_link-style"/>
8934
8944
 
8935
8945
  <xsl:choose>
@@ -8940,6 +8950,9 @@
8940
8950
  <xsl:call-template name="insert_basic_link">
8941
8951
  <xsl:with-param name="element">
8942
8952
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8953
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8954
+ <xsl:attribute name="role">Annot</xsl:attribute>
8955
+ </xsl:if>
8943
8956
  <xsl:choose>
8944
8957
  <xsl:when test="normalize-space(.) = ''">
8945
8958
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8952,6 +8965,10 @@
8952
8965
  </xsl:otherwise>
8953
8966
  </xsl:choose>
8954
8967
  </fo:basic-link>
8968
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8969
+ <!-- reserve space at right for PaperClip icon -->
8970
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8971
+ </xsl:if>
8955
8972
  </xsl:with-param>
8956
8973
  </xsl:call-template>
8957
8974
  </xsl:otherwise>
@@ -14503,9 +14520,14 @@
14503
14520
  </x:xmpmeta>
14504
14521
  <!-- add attachments -->
14505
14522
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14506
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14507
-
14508
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14523
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
14524
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
14525
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14526
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14527
+ <!-- Todo: need update -->
14528
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14529
+
14530
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14509
14531
  <xsl:attribute name="src">
14510
14532
  <xsl:choose>
14511
14533
  <xsl:when test="normalize-space() != ''">
@@ -14521,18 +14543,27 @@
14521
14543
  <xsl:if test="$description != ''">
14522
14544
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14523
14545
  </xsl:if>
14546
+ <xsl:if test="$afrelationship != ''">
14547
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14548
+ </xsl:if>
14524
14549
  </pdf:embedded-file>
14525
14550
  </xsl:for-each>
14526
14551
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14527
14552
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14528
14553
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14529
14554
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14555
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
14530
14556
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14531
14557
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14532
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14558
+ <!-- Todo: need update -->
14559
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14560
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14533
14561
  <xsl:if test="$description != ''">
14534
14562
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14535
14563
  </xsl:if>
14564
+ <xsl:if test="$afrelationship != ''">
14565
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14566
+ </xsl:if>
14536
14567
  </pdf:embedded-file>
14537
14568
  </xsl:for-each>
14538
14569
  </xsl:if>
@@ -14552,6 +14583,12 @@
14552
14583
  <!-- Get or calculate depth of the element -->
14553
14584
  <xsl:template name="getLevel">
14554
14585
  <xsl:param name="depth"/>
14586
+ <!-- <xsl:message>
14587
+ <xsl:choose>
14588
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
14589
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
14590
+ </xsl:choose>
14591
+ </xsl:message> -->
14555
14592
  <xsl:choose>
14556
14593
  <xsl:when test="normalize-space(@depth) != ''">
14557
14594
  <xsl:value-of select="@depth"/>
@@ -14572,8 +14609,27 @@
14572
14609
  <xsl:when test="ancestor::*[local-name() = 'preface']">
14573
14610
  <xsl:value-of select="$level_total - 2"/>
14574
14611
  </xsl:when>
14612
+ <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)"/>
14614
+ <xsl:choose>
14615
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14616
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14617
+ </xsl:when>
14618
+ <xsl:otherwise>
14619
+ <xsl:value-of select="$level_total - 2"/>
14620
+ </xsl:otherwise>
14621
+ </xsl:choose>
14622
+ </xsl:when>
14575
14623
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14576
- <xsl:value-of select="$level_total - 1"/>
14624
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14625
+ <xsl:choose>
14626
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14627
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14628
+ </xsl:when>
14629
+ <xsl:otherwise>
14630
+ <xsl:value-of select="$level_total - 1"/>
14631
+ </xsl:otherwise>
14632
+ </xsl:choose>
14577
14633
  </xsl:when>
14578
14634
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
14579
14635
  <xsl:value-of select="$level_total - 1"/>
@@ -14581,6 +14637,17 @@
14581
14637
  <xsl:when test="parent::*[local-name() = 'annex']">
14582
14638
  <xsl:value-of select="$level_total - 1"/>
14583
14639
  </xsl:when>
14640
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
14641
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14642
+ <xsl:choose>
14643
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14644
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14645
+ </xsl:when>
14646
+ <xsl:otherwise>
14647
+ <xsl:value-of select="$level_total - 1"/>
14648
+ </xsl:otherwise>
14649
+ </xsl:choose>
14650
+ </xsl:when>
14584
14651
  <xsl:when test="ancestor::*[local-name() = 'annex']">
14585
14652
  <xsl:value-of select="$level_total"/>
14586
14653
  </xsl:when>
@@ -14939,6 +15006,20 @@
14939
15006
 
14940
15007
  <!-- END: insert cover page image -->
14941
15008
 
15009
+ <xsl:template name="insertVerticalChar">
15010
+ <xsl:param name="str"/>
15011
+ <xsl:if test="string-length($str) &gt; 0">
15012
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
15013
+ <fo:block-container width="1em">
15014
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
15015
+ </fo:block-container>
15016
+ </fo:inline-container>
15017
+ <xsl:call-template name="insertVerticalChar">
15018
+ <xsl:with-param name="str" select="substring($str, 2)"/>
15019
+ </xsl:call-template>
15020
+ </xsl:if>
15021
+ </xsl:template>
15022
+
14942
15023
  <xsl:template name="number-to-words">
14943
15024
  <xsl:param name="number"/>
14944
15025
  <xsl:param name="first"/>
@@ -15226,4 +15307,18 @@
15226
15307
  </xsl:if>
15227
15308
  </xsl:template>
15228
15309
 
15310
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
15311
+ <xsl:copy>
15312
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
15313
+ </xsl:copy>
15314
+ </xsl:template>
15315
+
15316
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
15317
+ <xsl:copy>
15318
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
15319
+ <xsl:attribute name="role">SKIP</xsl:attribute>
15320
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
15321
+ </xsl:copy>
15322
+ </xsl:template>
15323
+
15229
15324
  </xsl:stylesheet>
@@ -21,7 +21,7 @@ module IsoDoc
21
21
  end
22
22
 
23
23
  def middle_sections
24
- "//clause[@type = 'scope'] | " \
24
+ "//clause[@type = 'scope'] | //preface/abstract | " \
25
25
  "//foreword | //introduction | //acknowledgements | " \
26
26
  "#{@klass.norm_ref_xpath} | " \
27
27
  "//sections/terms | //preface/clause | " \
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.5.3".freeze
3
+ VERSION = "2.5.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc