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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42edc246f664fa8b8888607aad04900531584ed175a96ef2a2aaea9039580468
4
- data.tar.gz: 3927bfff57be9492a0b548c6ea3c3f1dfb9d8313263b05114d131271edb97b11
3
+ metadata.gz: aeef499368ee7c6a53777c5b7a78b0bcd330532814beceb0ea34704ec58d1c8c
4
+ data.tar.gz: 52f881e446af35c9c55e5947d5379e38d2235b42ae51cb43cc776113bfd9d335
5
5
  SHA512:
6
- metadata.gz: 6e42b70ae4cdebe42e9bfde83e0e895bbcde0fc5aade85a16e8923ffdec17a1d7feecddea76090a23794e021f5e2dfa71db6118c4c099ea44fd0962b21d11f97
7
- data.tar.gz: ec418558ceab2dd56cf5ade9b92d90b3b48fb5da84b7e2d5956541f322e72a49294fc4df35eeb6489f437970b583aba169438da7a3d7983ca241005aaabb060e
6
+ metadata.gz: ab4bbdb14b34bee6212dffad59eb9a81d73273b2ef74e5472d658bc8b7ec8fabfe8213dad40a081839088c7012d0dce3e8ba3358e7a38e10c6be8411434d0090
7
+ data.tar.gz: 8babf0fa94d31feb0bad1d441e69454afb15a48e72b93ee8934f45ccbac757eb64f2121e7161d6910a0ad563f8f8b2e562c1c466966057130fa3e1dbdd3fe7b2
@@ -75,6 +75,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
75
75
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
76
76
  font-size: {{monospacefontsize}}; }
77
77
 
78
+ sub, sup {
79
+ font-size: 0.75em; }
80
+
78
81
  article, aside, details, figcaption, figure,
79
82
  footer, header, hgroup, menu, nav, section {
80
83
  display: block; }
@@ -75,6 +75,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
75
75
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
76
76
  font-size: {{monospacefontsize}}; }
77
77
 
78
+ sub, sup {
79
+ font-size: 0.75em; }
80
+
78
81
  article, aside, details, figcaption, figure,
79
82
  footer, header, hgroup, menu, nav, section {
80
83
  display: block; }
@@ -458,6 +461,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
458
461
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
459
462
  font-size: {{monospacefontsize}}; }
460
463
 
464
+ sub, sup {
465
+ font-size: 0.75em; }
466
+
461
467
  article, aside, details, figcaption, figure,
462
468
  footer, header, hgroup, menu, nav, section {
463
469
  display: block; }
@@ -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>
@@ -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>