metanorma-un 0.12.18 → 0.12.19

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: d3ed809ee46234548dc735e697db8315a7670bee1d5e9aa62aa033b8a766820a
4
- data.tar.gz: 1b116150e9b52db0e140c61ad0657939704ad4d52a82dd98ec7180b9e97e9a21
3
+ metadata.gz: 1b9b752865cc5717b27cc3d49dbc35a916aee99431b4931622b633e84abc7e1f
4
+ data.tar.gz: 5a587abcc9ca2d464e00756b452ceb2e14940b64e54d9195f1879b390fd985e1
5
5
  SHA512:
6
- metadata.gz: f295ab7c71802e0255ad1b00d7933c0f96a30ebae17a2f64120451f10ce1773795dec033b817b052282a507757250a64803473329b1a13106ff35dda679a29d5
7
- data.tar.gz: f0ca4c27ba5d075343656e1f2e34af7a9c7a940bece961d6b9a0dbd92c2d565f25668999ad6365bc7b26d561bd4b856a7d211c7dc3deede4114f668c66a5ed42
6
+ metadata.gz: e30f8961a85d39e0dc9140dee2223eb50feebc3b0c40d3176cac97005368dc3a97cfbe177d6e7a3b731cd3afe8b14bbe423b2600edcac6c7cc16c98d8e237a73
7
+ data.tar.gz: bfca724a1d193de389616fe001ffe4b460d464a967897d29848d2aa8ddbba69b794df928958f6fb5d61c7cab1833358da6de767055746d82fe3d2d6d8a09d012
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -4105,6 +4105,7 @@
4105
4105
 
4106
4106
  <fo:block role="SKIP">
4107
4107
  <xsl:apply-templates/>
4108
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4108
4109
  </fo:block>
4109
4110
  </fo:table-cell>
4110
4111
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -4168,6 +4169,8 @@
4168
4169
 
4169
4170
  <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"/> -->
4170
4171
 
4172
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4173
+
4171
4174
  </fo:block>
4172
4175
  </fo:table-cell>
4173
4176
  </xsl:template> <!-- td -->
@@ -6951,14 +6954,16 @@
6951
6954
  <xsl:template match="*[local-name()='link']" name="link">
6952
6955
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6953
6956
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6957
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
6954
6958
  <xsl:variable name="target">
6955
6959
  <xsl:choose>
6956
6960
  <xsl:when test="@updatetype = 'true'">
6957
6961
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6958
6962
  </xsl:when>
6959
6963
  <!-- link to the PDF attachment -->
6960
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
6961
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6964
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
6965
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
6966
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
6962
6967
  </xsl:when>
6963
6968
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6964
6969
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -6989,6 +6994,11 @@
6989
6994
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6990
6995
  </xsl:if>
6991
6996
 
6997
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
6998
+ <xsl:attribute name="color">inherit</xsl:attribute>
6999
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7000
+ </xsl:if>
7001
+
6992
7002
  <xsl:call-template name="refine_link-style"/>
6993
7003
 
6994
7004
  <xsl:choose>
@@ -6999,6 +7009,9 @@
6999
7009
  <xsl:call-template name="insert_basic_link">
7000
7010
  <xsl:with-param name="element">
7001
7011
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7012
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7013
+ <xsl:attribute name="role">Annot</xsl:attribute>
7014
+ </xsl:if>
7002
7015
  <xsl:choose>
7003
7016
  <xsl:when test="normalize-space(.) = ''">
7004
7017
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7011,6 +7024,10 @@
7011
7024
  </xsl:otherwise>
7012
7025
  </xsl:choose>
7013
7026
  </fo:basic-link>
7027
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7028
+ <!-- reserve space at right for PaperClip icon -->
7029
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7030
+ </xsl:if>
7014
7031
  </xsl:with-param>
7015
7032
  </xsl:call-template>
7016
7033
  </xsl:otherwise>
@@ -12521,9 +12538,14 @@
12521
12538
  </x:xmpmeta>
12522
12539
  <!-- add attachments -->
12523
12540
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12524
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12525
-
12526
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12541
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
12542
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
12543
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
12544
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
12545
+ <!-- Todo: need update -->
12546
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12547
+
12548
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
12527
12549
  <xsl:attribute name="src">
12528
12550
  <xsl:choose>
12529
12551
  <xsl:when test="normalize-space() != ''">
@@ -12539,18 +12561,27 @@
12539
12561
  <xsl:if test="$description != ''">
12540
12562
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12541
12563
  </xsl:if>
12564
+ <xsl:if test="$afrelationship != ''">
12565
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12566
+ </xsl:if>
12542
12567
  </pdf:embedded-file>
12543
12568
  </xsl:for-each>
12544
12569
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12545
12570
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12546
12571
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12547
12572
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12573
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
12548
12574
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12549
12575
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12550
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12576
+ <!-- Todo: need update -->
12577
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12578
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
12551
12579
  <xsl:if test="$description != ''">
12552
12580
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12553
12581
  </xsl:if>
12582
+ <xsl:if test="$afrelationship != ''">
12583
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12584
+ </xsl:if>
12554
12585
  </pdf:embedded-file>
12555
12586
  </xsl:for-each>
12556
12587
  </xsl:if>
@@ -12570,6 +12601,12 @@
12570
12601
  <!-- Get or calculate depth of the element -->
12571
12602
  <xsl:template name="getLevel">
12572
12603
  <xsl:param name="depth"/>
12604
+ <!-- <xsl:message>
12605
+ <xsl:choose>
12606
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
12607
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
12608
+ </xsl:choose>
12609
+ </xsl:message> -->
12573
12610
  <xsl:choose>
12574
12611
  <xsl:when test="normalize-space(@depth) != ''">
12575
12612
  <xsl:value-of select="@depth"/>
@@ -12590,8 +12627,27 @@
12590
12627
  <xsl:when test="ancestor::*[local-name() = 'preface']">
12591
12628
  <xsl:value-of select="$level_total - 2"/>
12592
12629
  </xsl:when>
12630
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
12631
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12632
+ <xsl:choose>
12633
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12634
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12635
+ </xsl:when>
12636
+ <xsl:otherwise>
12637
+ <xsl:value-of select="$level_total - 2"/>
12638
+ </xsl:otherwise>
12639
+ </xsl:choose>
12640
+ </xsl:when>
12593
12641
  <xsl:when test="ancestor::*[local-name() = 'sections']">
12594
- <xsl:value-of select="$level_total - 1"/>
12642
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
12643
+ <xsl:choose>
12644
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12645
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12646
+ </xsl:when>
12647
+ <xsl:otherwise>
12648
+ <xsl:value-of select="$level_total - 1"/>
12649
+ </xsl:otherwise>
12650
+ </xsl:choose>
12595
12651
  </xsl:when>
12596
12652
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
12597
12653
  <xsl:value-of select="$level_total - 1"/>
@@ -12599,6 +12655,17 @@
12599
12655
  <xsl:when test="parent::*[local-name() = 'annex']">
12600
12656
  <xsl:value-of select="$level_total - 1"/>
12601
12657
  </xsl:when>
12658
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
12659
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12660
+ <xsl:choose>
12661
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12662
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12663
+ </xsl:when>
12664
+ <xsl:otherwise>
12665
+ <xsl:value-of select="$level_total - 1"/>
12666
+ </xsl:otherwise>
12667
+ </xsl:choose>
12668
+ </xsl:when>
12602
12669
  <xsl:when test="ancestor::*[local-name() = 'annex']">
12603
12670
  <xsl:value-of select="$level_total"/>
12604
12671
  </xsl:when>
@@ -12957,6 +13024,20 @@
12957
13024
 
12958
13025
  <!-- END: insert cover page image -->
12959
13026
 
13027
+ <xsl:template name="insertVerticalChar">
13028
+ <xsl:param name="str"/>
13029
+ <xsl:if test="string-length($str) &gt; 0">
13030
+ <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">
13031
+ <fo:block-container width="1em">
13032
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
13033
+ </fo:block-container>
13034
+ </fo:inline-container>
13035
+ <xsl:call-template name="insertVerticalChar">
13036
+ <xsl:with-param name="str" select="substring($str, 2)"/>
13037
+ </xsl:call-template>
13038
+ </xsl:if>
13039
+ </xsl:template>
13040
+
12960
13041
  <xsl:template name="number-to-words">
12961
13042
  <xsl:param name="number"/>
12962
13043
  <xsl:param name="first"/>
@@ -13244,4 +13325,18 @@
13244
13325
  </xsl:if>
13245
13326
  </xsl:template>
13246
13327
 
13328
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
13329
+ <xsl:copy>
13330
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
13331
+ </xsl:copy>
13332
+ </xsl:template>
13333
+
13334
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
13335
+ <xsl:copy>
13336
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
13337
+ <xsl:attribute name="role">SKIP</xsl:attribute>
13338
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
13339
+ </xsl:copy>
13340
+ </xsl:template>
13341
+
13247
13342
  </xsl:stylesheet>
@@ -4105,6 +4105,7 @@
4105
4105
 
4106
4106
  <fo:block role="SKIP">
4107
4107
  <xsl:apply-templates/>
4108
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4108
4109
  </fo:block>
4109
4110
  </fo:table-cell>
4110
4111
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -4168,6 +4169,8 @@
4168
4169
 
4169
4170
  <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"/> -->
4170
4171
 
4172
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4173
+
4171
4174
  </fo:block>
4172
4175
  </fo:table-cell>
4173
4176
  </xsl:template> <!-- td -->
@@ -6951,14 +6954,16 @@
6951
6954
  <xsl:template match="*[local-name()='link']" name="link">
6952
6955
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6953
6956
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6957
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
6954
6958
  <xsl:variable name="target">
6955
6959
  <xsl:choose>
6956
6960
  <xsl:when test="@updatetype = 'true'">
6957
6961
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6958
6962
  </xsl:when>
6959
6963
  <!-- link to the PDF attachment -->
6960
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
6961
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6964
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
6965
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
6966
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
6962
6967
  </xsl:when>
6963
6968
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6964
6969
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -6989,6 +6994,11 @@
6989
6994
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6990
6995
  </xsl:if>
6991
6996
 
6997
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
6998
+ <xsl:attribute name="color">inherit</xsl:attribute>
6999
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7000
+ </xsl:if>
7001
+
6992
7002
  <xsl:call-template name="refine_link-style"/>
6993
7003
 
6994
7004
  <xsl:choose>
@@ -6999,6 +7009,9 @@
6999
7009
  <xsl:call-template name="insert_basic_link">
7000
7010
  <xsl:with-param name="element">
7001
7011
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7012
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7013
+ <xsl:attribute name="role">Annot</xsl:attribute>
7014
+ </xsl:if>
7002
7015
  <xsl:choose>
7003
7016
  <xsl:when test="normalize-space(.) = ''">
7004
7017
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7011,6 +7024,10 @@
7011
7024
  </xsl:otherwise>
7012
7025
  </xsl:choose>
7013
7026
  </fo:basic-link>
7027
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7028
+ <!-- reserve space at right for PaperClip icon -->
7029
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7030
+ </xsl:if>
7014
7031
  </xsl:with-param>
7015
7032
  </xsl:call-template>
7016
7033
  </xsl:otherwise>
@@ -12521,9 +12538,14 @@
12521
12538
  </x:xmpmeta>
12522
12539
  <!-- add attachments -->
12523
12540
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12524
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12525
-
12526
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12541
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
12542
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
12543
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
12544
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
12545
+ <!-- Todo: need update -->
12546
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12547
+
12548
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
12527
12549
  <xsl:attribute name="src">
12528
12550
  <xsl:choose>
12529
12551
  <xsl:when test="normalize-space() != ''">
@@ -12539,18 +12561,27 @@
12539
12561
  <xsl:if test="$description != ''">
12540
12562
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12541
12563
  </xsl:if>
12564
+ <xsl:if test="$afrelationship != ''">
12565
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12566
+ </xsl:if>
12542
12567
  </pdf:embedded-file>
12543
12568
  </xsl:for-each>
12544
12569
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12545
12570
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12546
12571
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12547
12572
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12573
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
12548
12574
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12549
12575
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12550
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12576
+ <!-- Todo: need update -->
12577
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12578
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
12551
12579
  <xsl:if test="$description != ''">
12552
12580
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12553
12581
  </xsl:if>
12582
+ <xsl:if test="$afrelationship != ''">
12583
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12584
+ </xsl:if>
12554
12585
  </pdf:embedded-file>
12555
12586
  </xsl:for-each>
12556
12587
  </xsl:if>
@@ -12570,6 +12601,12 @@
12570
12601
  <!-- Get or calculate depth of the element -->
12571
12602
  <xsl:template name="getLevel">
12572
12603
  <xsl:param name="depth"/>
12604
+ <!-- <xsl:message>
12605
+ <xsl:choose>
12606
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
12607
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
12608
+ </xsl:choose>
12609
+ </xsl:message> -->
12573
12610
  <xsl:choose>
12574
12611
  <xsl:when test="normalize-space(@depth) != ''">
12575
12612
  <xsl:value-of select="@depth"/>
@@ -12590,8 +12627,27 @@
12590
12627
  <xsl:when test="ancestor::*[local-name() = 'preface']">
12591
12628
  <xsl:value-of select="$level_total - 2"/>
12592
12629
  </xsl:when>
12630
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
12631
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12632
+ <xsl:choose>
12633
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12634
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12635
+ </xsl:when>
12636
+ <xsl:otherwise>
12637
+ <xsl:value-of select="$level_total - 2"/>
12638
+ </xsl:otherwise>
12639
+ </xsl:choose>
12640
+ </xsl:when>
12593
12641
  <xsl:when test="ancestor::*[local-name() = 'sections']">
12594
- <xsl:value-of select="$level_total - 1"/>
12642
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
12643
+ <xsl:choose>
12644
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12645
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12646
+ </xsl:when>
12647
+ <xsl:otherwise>
12648
+ <xsl:value-of select="$level_total - 1"/>
12649
+ </xsl:otherwise>
12650
+ </xsl:choose>
12595
12651
  </xsl:when>
12596
12652
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
12597
12653
  <xsl:value-of select="$level_total - 1"/>
@@ -12599,6 +12655,17 @@
12599
12655
  <xsl:when test="parent::*[local-name() = 'annex']">
12600
12656
  <xsl:value-of select="$level_total - 1"/>
12601
12657
  </xsl:when>
12658
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
12659
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12660
+ <xsl:choose>
12661
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12662
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12663
+ </xsl:when>
12664
+ <xsl:otherwise>
12665
+ <xsl:value-of select="$level_total - 1"/>
12666
+ </xsl:otherwise>
12667
+ </xsl:choose>
12668
+ </xsl:when>
12602
12669
  <xsl:when test="ancestor::*[local-name() = 'annex']">
12603
12670
  <xsl:value-of select="$level_total"/>
12604
12671
  </xsl:when>
@@ -12957,6 +13024,20 @@
12957
13024
 
12958
13025
  <!-- END: insert cover page image -->
12959
13026
 
13027
+ <xsl:template name="insertVerticalChar">
13028
+ <xsl:param name="str"/>
13029
+ <xsl:if test="string-length($str) &gt; 0">
13030
+ <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">
13031
+ <fo:block-container width="1em">
13032
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
13033
+ </fo:block-container>
13034
+ </fo:inline-container>
13035
+ <xsl:call-template name="insertVerticalChar">
13036
+ <xsl:with-param name="str" select="substring($str, 2)"/>
13037
+ </xsl:call-template>
13038
+ </xsl:if>
13039
+ </xsl:template>
13040
+
12960
13041
  <xsl:template name="number-to-words">
12961
13042
  <xsl:param name="number"/>
12962
13043
  <xsl:param name="first"/>
@@ -13244,4 +13325,18 @@
13244
13325
  </xsl:if>
13245
13326
  </xsl:template>
13246
13327
 
13328
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
13329
+ <xsl:copy>
13330
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
13331
+ </xsl:copy>
13332
+ </xsl:template>
13333
+
13334
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
13335
+ <xsl:copy>
13336
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
13337
+ <xsl:attribute name="role">SKIP</xsl:attribute>
13338
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
13339
+ </xsl:copy>
13340
+ </xsl:template>
13341
+
13247
13342
  </xsl:stylesheet>
@@ -4204,6 +4204,7 @@
4204
4204
 
4205
4205
  <fo:block role="SKIP">
4206
4206
  <xsl:apply-templates/>
4207
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4207
4208
  </fo:block>
4208
4209
  </fo:table-cell>
4209
4210
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -4267,6 +4268,8 @@
4267
4268
 
4268
4269
  <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"/> -->
4269
4270
 
4271
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4272
+
4270
4273
  </fo:block>
4271
4274
  </fo:table-cell>
4272
4275
  </xsl:template> <!-- td -->
@@ -7050,14 +7053,16 @@
7050
7053
  <xsl:template match="*[local-name()='link']" name="link">
7051
7054
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7052
7055
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7056
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7053
7057
  <xsl:variable name="target">
7054
7058
  <xsl:choose>
7055
7059
  <xsl:when test="@updatetype = 'true'">
7056
7060
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7057
7061
  </xsl:when>
7058
7062
  <!-- link to the PDF attachment -->
7059
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7060
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7063
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7064
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7065
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7061
7066
  </xsl:when>
7062
7067
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7063
7068
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7088,6 +7093,11 @@
7088
7093
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7089
7094
  </xsl:if>
7090
7095
 
7096
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7097
+ <xsl:attribute name="color">inherit</xsl:attribute>
7098
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7099
+ </xsl:if>
7100
+
7091
7101
  <xsl:call-template name="refine_link-style"/>
7092
7102
 
7093
7103
  <xsl:choose>
@@ -7098,6 +7108,9 @@
7098
7108
  <xsl:call-template name="insert_basic_link">
7099
7109
  <xsl:with-param name="element">
7100
7110
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7111
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7112
+ <xsl:attribute name="role">Annot</xsl:attribute>
7113
+ </xsl:if>
7101
7114
  <xsl:choose>
7102
7115
  <xsl:when test="normalize-space(.) = ''">
7103
7116
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7110,6 +7123,10 @@
7110
7123
  </xsl:otherwise>
7111
7124
  </xsl:choose>
7112
7125
  </fo:basic-link>
7126
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7127
+ <!-- reserve space at right for PaperClip icon -->
7128
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7129
+ </xsl:if>
7113
7130
  </xsl:with-param>
7114
7131
  </xsl:call-template>
7115
7132
  </xsl:otherwise>
@@ -12621,9 +12638,14 @@
12621
12638
  </x:xmpmeta>
12622
12639
  <!-- add attachments -->
12623
12640
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12624
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12625
-
12626
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12641
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
12642
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
12643
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
12644
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
12645
+ <!-- Todo: need update -->
12646
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12647
+
12648
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
12627
12649
  <xsl:attribute name="src">
12628
12650
  <xsl:choose>
12629
12651
  <xsl:when test="normalize-space() != ''">
@@ -12639,18 +12661,27 @@
12639
12661
  <xsl:if test="$description != ''">
12640
12662
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12641
12663
  </xsl:if>
12664
+ <xsl:if test="$afrelationship != ''">
12665
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12666
+ </xsl:if>
12642
12667
  </pdf:embedded-file>
12643
12668
  </xsl:for-each>
12644
12669
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12645
12670
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12646
12671
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12647
12672
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12673
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
12648
12674
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12649
12675
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12650
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12676
+ <!-- Todo: need update -->
12677
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12678
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
12651
12679
  <xsl:if test="$description != ''">
12652
12680
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12653
12681
  </xsl:if>
12682
+ <xsl:if test="$afrelationship != ''">
12683
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12684
+ </xsl:if>
12654
12685
  </pdf:embedded-file>
12655
12686
  </xsl:for-each>
12656
12687
  </xsl:if>
@@ -12670,6 +12701,12 @@
12670
12701
  <!-- Get or calculate depth of the element -->
12671
12702
  <xsl:template name="getLevel">
12672
12703
  <xsl:param name="depth"/>
12704
+ <!-- <xsl:message>
12705
+ <xsl:choose>
12706
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
12707
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
12708
+ </xsl:choose>
12709
+ </xsl:message> -->
12673
12710
  <xsl:choose>
12674
12711
  <xsl:when test="normalize-space(@depth) != ''">
12675
12712
  <xsl:value-of select="@depth"/>
@@ -12690,8 +12727,27 @@
12690
12727
  <xsl:when test="ancestor::*[local-name() = 'preface']">
12691
12728
  <xsl:value-of select="$level_total - 2"/>
12692
12729
  </xsl:when>
12730
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
12731
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12732
+ <xsl:choose>
12733
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12734
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12735
+ </xsl:when>
12736
+ <xsl:otherwise>
12737
+ <xsl:value-of select="$level_total - 2"/>
12738
+ </xsl:otherwise>
12739
+ </xsl:choose>
12740
+ </xsl:when>
12693
12741
  <xsl:when test="ancestor::*[local-name() = 'sections']">
12694
- <xsl:value-of select="$level_total - 1"/>
12742
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
12743
+ <xsl:choose>
12744
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12745
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12746
+ </xsl:when>
12747
+ <xsl:otherwise>
12748
+ <xsl:value-of select="$level_total - 1"/>
12749
+ </xsl:otherwise>
12750
+ </xsl:choose>
12695
12751
  </xsl:when>
12696
12752
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
12697
12753
  <xsl:value-of select="$level_total - 1"/>
@@ -12699,6 +12755,17 @@
12699
12755
  <xsl:when test="parent::*[local-name() = 'annex']">
12700
12756
  <xsl:value-of select="$level_total - 1"/>
12701
12757
  </xsl:when>
12758
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
12759
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12760
+ <xsl:choose>
12761
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12762
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12763
+ </xsl:when>
12764
+ <xsl:otherwise>
12765
+ <xsl:value-of select="$level_total - 1"/>
12766
+ </xsl:otherwise>
12767
+ </xsl:choose>
12768
+ </xsl:when>
12702
12769
  <xsl:when test="ancestor::*[local-name() = 'annex']">
12703
12770
  <xsl:value-of select="$level_total"/>
12704
12771
  </xsl:when>
@@ -13057,6 +13124,20 @@
13057
13124
 
13058
13125
  <!-- END: insert cover page image -->
13059
13126
 
13127
+ <xsl:template name="insertVerticalChar">
13128
+ <xsl:param name="str"/>
13129
+ <xsl:if test="string-length($str) &gt; 0">
13130
+ <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">
13131
+ <fo:block-container width="1em">
13132
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
13133
+ </fo:block-container>
13134
+ </fo:inline-container>
13135
+ <xsl:call-template name="insertVerticalChar">
13136
+ <xsl:with-param name="str" select="substring($str, 2)"/>
13137
+ </xsl:call-template>
13138
+ </xsl:if>
13139
+ </xsl:template>
13140
+
13060
13141
  <xsl:template name="number-to-words">
13061
13142
  <xsl:param name="number"/>
13062
13143
  <xsl:param name="first"/>
@@ -13344,4 +13425,18 @@
13344
13425
  </xsl:if>
13345
13426
  </xsl:template>
13346
13427
 
13428
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
13429
+ <xsl:copy>
13430
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
13431
+ </xsl:copy>
13432
+ </xsl:template>
13433
+
13434
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
13435
+ <xsl:copy>
13436
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
13437
+ <xsl:attribute name="role">SKIP</xsl:attribute>
13438
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
13439
+ </xsl:copy>
13440
+ </xsl:template>
13441
+
13347
13442
  </xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.18".freeze
3
+ VERSION = "0.12.19".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.18
4
+ version: 0.12.19
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: iso-639