metanorma-ogc 2.6.0 → 2.6.1

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: a3c9e7230287337f9903c6e2628a5fb7b47ef3c8318e0a404d783564db1776c9
4
- data.tar.gz: cb7741ebe5cf3875f498388f88cd52c20bb67ff0801ed9f91384a92ed7e2d445
3
+ metadata.gz: 27c6878e7287b08cb973284d9b5f753f1f5aac697dc983a128c495649b38660d
4
+ data.tar.gz: 9ed25beb811a9f4a24b08e479581063160a6af5081c9e539043d9a6254b1da33
5
5
  SHA512:
6
- metadata.gz: 4ea130e97e8ad1a5d7500c1f624ef62b89295921e4b112c0ca7e0ad46be1de1cd0e48e5270a2c9e3206d2b710b3396ab4f1a03eee009ce610e4ad004ec483f81
7
- data.tar.gz: a3018511b9c1cca08f3c5d6c8ed8c6f500d1aebb839d352bef4724933bdfb74c36e34c1c18f0b6e421865a4cd78c68ab049e4ca3056dd0d010dab0d73c01bfdc
6
+ metadata.gz: 5bb9297e2ea6b848a8f604c6896a280fb6b4f8f81f34ea5b509a9a128fccd3a5552a2c47f3df19b5cd7283fb467558163fd2406843925e3b5fadc8c03898155c
7
+ data.tar.gz: 81bd653915b2c7f9b70c5748b302aae9074f0d329ffc6894bbc306f1750c48bc696afce2f4c42aa7810472ad40aa408f94fc3b644fa9a8f5d263830de004277d
@@ -20,17 +20,23 @@ toc_recommendations: List of Recommendations
20
20
  table_of_figures: Table of Figures
21
21
  security_empty: No security considerations have been made for this document.
22
22
  internal_terms_boilerplate: |
23
- <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
24
- <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
25
- <p>For the purposes of this document, the following additional terms and definitions apply.</p>
23
+ This document uses the terms defined in https://portal.ogc.org/public_ogc/directives/directives.php[OGC Policy Directive 49], which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.
24
+
25
+ This document also uses terms defined in the OGC Standard for Modular specifications (https://portal.opengeospatial.org/files/?artifact_id=34762[OGC 08-131r3]), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.
26
+
27
+ For the purposes of this document, the following additional terms and definitions apply.
26
28
  external_terms_boilerplate: |
27
- <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
28
- <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
29
- <p>For the purposes of this document, the terms and definitions given in % additionally apply.</p>
29
+ This document uses the terms defined in https://portal.ogc.org/public_ogc/directives/directives.php[OGC Policy Directive 49], which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.
30
+
31
+ This document also uses terms defined in the OGC Standard for Modular specifications (https://portal.opengeospatial.org/files/?artifact_id=34762[OGC 08-131r3]), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.
32
+
33
+ For the purposes of this document, the terms and definitions given in % additionally apply.
30
34
  internal_external_terms_boilerplate: |
31
- <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
32
- <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
33
- <p>For the purposes of this document, the terms and definitions given in % and the following additionally apply.</p>
35
+ This document uses the terms defined in https://portal.ogc.org/public_ogc/directives/directives.php[OGC Policy Directive 49], which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this document and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.
36
+
37
+ This document also uses terms defined in the OGC Standard for Modular specifications (https://portal.opengeospatial.org/files/?artifact_id=34762[OGC 08-131r3]), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.
38
+
39
+ For the purposes of this document, the terms and definitions given in % and the following additionally apply.
34
40
  term_defined_in: "(%)"
35
41
  submission_date: Submission Date
36
42
  approval_date: Approval Date
@@ -8103,6 +8103,12 @@
8103
8103
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8104
8104
  <attachment filename="{@name}"/>
8105
8105
  </xsl:for-each>
8106
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
8107
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
8108
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
8109
+ <attachment filename="{$attachment_path}"/>
8110
+ </xsl:for-each>
8111
+ </xsl:if>
8106
8112
  </xsl:variable>
8107
8113
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8108
8114
 
@@ -8115,7 +8121,7 @@
8115
8121
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8116
8122
  </xsl:when>
8117
8123
  <!-- link to the PDF attachment -->
8118
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8124
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8119
8125
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8120
8126
  </xsl:when>
8121
8127
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -8770,7 +8776,16 @@
8770
8776
  </xsl:variable>
8771
8777
  <xsl:variable name="img_src">
8772
8778
  <xsl:choose>
8773
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8779
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8780
+ <xsl:choose>
8781
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8782
+ <xsl:value-of select="@src"/>
8783
+ </xsl:when>
8784
+ <xsl:otherwise>
8785
+ <xsl:value-of select="concat($basepath, @src)"/>
8786
+ </xsl:otherwise>
8787
+ </xsl:choose>
8788
+ </xsl:when>
8774
8789
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8775
8790
  </xsl:choose>
8776
8791
  </xsl:variable>
@@ -8783,7 +8798,7 @@
8783
8798
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8784
8799
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8785
8800
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8786
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8801
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8787
8802
  <xsl:value-of select="$scale"/>
8788
8803
  </xsl:template>
8789
8804
 
@@ -8802,7 +8817,14 @@
8802
8817
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8803
8818
  </xsl:when>
8804
8819
  <xsl:when test="not(starts-with(@src, 'data:'))">
8805
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8820
+ <xsl:choose>
8821
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8822
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8823
+ </xsl:when>
8824
+ <xsl:otherwise>
8825
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8826
+ </xsl:otherwise>
8827
+ </xsl:choose>
8806
8828
  </xsl:when>
8807
8829
  <xsl:otherwise>
8808
8830
  <xsl:value-of select="@src"/>
@@ -8824,7 +8846,14 @@
8824
8846
  </xsl:when>
8825
8847
  <xsl:when test="not(starts-with(@src, 'data:'))">
8826
8848
  <xsl:variable name="src">
8827
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8849
+ <xsl:choose>
8850
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8851
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8852
+ </xsl:when>
8853
+ <xsl:otherwise>
8854
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8855
+ </xsl:otherwise>
8856
+ </xsl:choose>
8828
8857
  </xsl:variable>
8829
8858
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8830
8859
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -13659,26 +13688,37 @@
13659
13688
  </x:xmpmeta>
13660
13689
  <!-- add attachments -->
13661
13690
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13662
- <xsl:choose>
13663
- <xsl:when test="normalize-space() != ''">
13664
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13665
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13666
- </xsl:when>
13667
- <xsl:otherwise>
13668
- <!-- _{filename}_attachments -->
13669
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13670
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13671
- <pdf:embedded-file src="{$url}" filename="{@name}"/>
13672
- </xsl:otherwise>
13673
- </xsl:choose>
13691
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13692
+
13693
+ <pdf:embedded-file filename="{@name}">
13694
+ <xsl:attribute name="src">
13695
+ <xsl:choose>
13696
+ <xsl:when test="normalize-space() != ''">
13697
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13698
+ <xsl:value-of select="$src_attachment"/>
13699
+ </xsl:when>
13700
+ <xsl:otherwise>
13701
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13702
+ <xsl:value-of select="$url"/>
13703
+ </xsl:otherwise>
13704
+ </xsl:choose>
13705
+ </xsl:attribute>
13706
+ <xsl:if test="$description != ''">
13707
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13708
+ </xsl:if>
13709
+ </pdf:embedded-file>
13674
13710
  </xsl:for-each>
13675
13711
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13676
13712
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13677
13713
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13678
13714
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13679
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
13680
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
13681
- <pdf:embedded-file src="{$url}" filename="{$filename_embedded}"/>
13715
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13716
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13717
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13718
+ <xsl:if test="$description != ''">
13719
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13720
+ </xsl:if>
13721
+ </pdf:embedded-file>
13682
13722
  </xsl:for-each>
13683
13723
  </xsl:if>
13684
13724
  </xsl:template> <!-- addPDFUAmeta -->
@@ -14056,7 +14096,14 @@
14056
14096
  <xsl:value-of select="$src"/>
14057
14097
  </xsl:when>
14058
14098
  <xsl:otherwise>
14059
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14099
+ <xsl:choose>
14100
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14101
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14102
+ </xsl:when>
14103
+ <xsl:otherwise>
14104
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14105
+ </xsl:otherwise>
14106
+ </xsl:choose>
14060
14107
  </xsl:otherwise>
14061
14108
  </xsl:choose>
14062
14109
  </xsl:template>
@@ -8103,6 +8103,12 @@
8103
8103
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8104
8104
  <attachment filename="{@name}"/>
8105
8105
  </xsl:for-each>
8106
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
8107
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
8108
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
8109
+ <attachment filename="{$attachment_path}"/>
8110
+ </xsl:for-each>
8111
+ </xsl:if>
8106
8112
  </xsl:variable>
8107
8113
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8108
8114
 
@@ -8115,7 +8121,7 @@
8115
8121
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8116
8122
  </xsl:when>
8117
8123
  <!-- link to the PDF attachment -->
8118
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8124
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8119
8125
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8120
8126
  </xsl:when>
8121
8127
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -8770,7 +8776,16 @@
8770
8776
  </xsl:variable>
8771
8777
  <xsl:variable name="img_src">
8772
8778
  <xsl:choose>
8773
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8779
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8780
+ <xsl:choose>
8781
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8782
+ <xsl:value-of select="@src"/>
8783
+ </xsl:when>
8784
+ <xsl:otherwise>
8785
+ <xsl:value-of select="concat($basepath, @src)"/>
8786
+ </xsl:otherwise>
8787
+ </xsl:choose>
8788
+ </xsl:when>
8774
8789
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8775
8790
  </xsl:choose>
8776
8791
  </xsl:variable>
@@ -8783,7 +8798,7 @@
8783
8798
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8784
8799
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8785
8800
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8786
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8801
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8787
8802
  <xsl:value-of select="$scale"/>
8788
8803
  </xsl:template>
8789
8804
 
@@ -8802,7 +8817,14 @@
8802
8817
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8803
8818
  </xsl:when>
8804
8819
  <xsl:when test="not(starts-with(@src, 'data:'))">
8805
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8820
+ <xsl:choose>
8821
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8822
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8823
+ </xsl:when>
8824
+ <xsl:otherwise>
8825
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8826
+ </xsl:otherwise>
8827
+ </xsl:choose>
8806
8828
  </xsl:when>
8807
8829
  <xsl:otherwise>
8808
8830
  <xsl:value-of select="@src"/>
@@ -8824,7 +8846,14 @@
8824
8846
  </xsl:when>
8825
8847
  <xsl:when test="not(starts-with(@src, 'data:'))">
8826
8848
  <xsl:variable name="src">
8827
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8849
+ <xsl:choose>
8850
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8851
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8852
+ </xsl:when>
8853
+ <xsl:otherwise>
8854
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8855
+ </xsl:otherwise>
8856
+ </xsl:choose>
8828
8857
  </xsl:variable>
8829
8858
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8830
8859
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -13659,26 +13688,37 @@
13659
13688
  </x:xmpmeta>
13660
13689
  <!-- add attachments -->
13661
13690
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13662
- <xsl:choose>
13663
- <xsl:when test="normalize-space() != ''">
13664
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13665
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13666
- </xsl:when>
13667
- <xsl:otherwise>
13668
- <!-- _{filename}_attachments -->
13669
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13670
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13671
- <pdf:embedded-file src="{$url}" filename="{@name}"/>
13672
- </xsl:otherwise>
13673
- </xsl:choose>
13691
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13692
+
13693
+ <pdf:embedded-file filename="{@name}">
13694
+ <xsl:attribute name="src">
13695
+ <xsl:choose>
13696
+ <xsl:when test="normalize-space() != ''">
13697
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13698
+ <xsl:value-of select="$src_attachment"/>
13699
+ </xsl:when>
13700
+ <xsl:otherwise>
13701
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13702
+ <xsl:value-of select="$url"/>
13703
+ </xsl:otherwise>
13704
+ </xsl:choose>
13705
+ </xsl:attribute>
13706
+ <xsl:if test="$description != ''">
13707
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13708
+ </xsl:if>
13709
+ </pdf:embedded-file>
13674
13710
  </xsl:for-each>
13675
13711
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13676
13712
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13677
13713
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13678
13714
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13679
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
13680
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
13681
- <pdf:embedded-file src="{$url}" filename="{$filename_embedded}"/>
13715
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13716
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13717
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13718
+ <xsl:if test="$description != ''">
13719
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13720
+ </xsl:if>
13721
+ </pdf:embedded-file>
13682
13722
  </xsl:for-each>
13683
13723
  </xsl:if>
13684
13724
  </xsl:template> <!-- addPDFUAmeta -->
@@ -14056,7 +14096,14 @@
14056
14096
  <xsl:value-of select="$src"/>
14057
14097
  </xsl:when>
14058
14098
  <xsl:otherwise>
14059
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14099
+ <xsl:choose>
14100
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14101
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14102
+ </xsl:when>
14103
+ <xsl:otherwise>
14104
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14105
+ </xsl:otherwise>
14106
+ </xsl:choose>
14060
14107
  </xsl:otherwise>
14061
14108
  </xsl:choose>
14062
14109
  </xsl:template>
@@ -8103,6 +8103,12 @@
8103
8103
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8104
8104
  <attachment filename="{@name}"/>
8105
8105
  </xsl:for-each>
8106
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
8107
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
8108
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
8109
+ <attachment filename="{$attachment_path}"/>
8110
+ </xsl:for-each>
8111
+ </xsl:if>
8106
8112
  </xsl:variable>
8107
8113
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8108
8114
 
@@ -8115,7 +8121,7 @@
8115
8121
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8116
8122
  </xsl:when>
8117
8123
  <!-- link to the PDF attachment -->
8118
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8124
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8119
8125
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8120
8126
  </xsl:when>
8121
8127
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -8770,7 +8776,16 @@
8770
8776
  </xsl:variable>
8771
8777
  <xsl:variable name="img_src">
8772
8778
  <xsl:choose>
8773
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8779
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8780
+ <xsl:choose>
8781
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8782
+ <xsl:value-of select="@src"/>
8783
+ </xsl:when>
8784
+ <xsl:otherwise>
8785
+ <xsl:value-of select="concat($basepath, @src)"/>
8786
+ </xsl:otherwise>
8787
+ </xsl:choose>
8788
+ </xsl:when>
8774
8789
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8775
8790
  </xsl:choose>
8776
8791
  </xsl:variable>
@@ -8783,7 +8798,7 @@
8783
8798
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8784
8799
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8785
8800
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8786
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8801
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8787
8802
  <xsl:value-of select="$scale"/>
8788
8803
  </xsl:template>
8789
8804
 
@@ -8802,7 +8817,14 @@
8802
8817
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8803
8818
  </xsl:when>
8804
8819
  <xsl:when test="not(starts-with(@src, 'data:'))">
8805
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8820
+ <xsl:choose>
8821
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8822
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8823
+ </xsl:when>
8824
+ <xsl:otherwise>
8825
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8826
+ </xsl:otherwise>
8827
+ </xsl:choose>
8806
8828
  </xsl:when>
8807
8829
  <xsl:otherwise>
8808
8830
  <xsl:value-of select="@src"/>
@@ -8824,7 +8846,14 @@
8824
8846
  </xsl:when>
8825
8847
  <xsl:when test="not(starts-with(@src, 'data:'))">
8826
8848
  <xsl:variable name="src">
8827
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8849
+ <xsl:choose>
8850
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8851
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8852
+ </xsl:when>
8853
+ <xsl:otherwise>
8854
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8855
+ </xsl:otherwise>
8856
+ </xsl:choose>
8828
8857
  </xsl:variable>
8829
8858
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8830
8859
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -13659,26 +13688,37 @@
13659
13688
  </x:xmpmeta>
13660
13689
  <!-- add attachments -->
13661
13690
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13662
- <xsl:choose>
13663
- <xsl:when test="normalize-space() != ''">
13664
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13665
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13666
- </xsl:when>
13667
- <xsl:otherwise>
13668
- <!-- _{filename}_attachments -->
13669
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13670
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13671
- <pdf:embedded-file src="{$url}" filename="{@name}"/>
13672
- </xsl:otherwise>
13673
- </xsl:choose>
13691
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13692
+
13693
+ <pdf:embedded-file filename="{@name}">
13694
+ <xsl:attribute name="src">
13695
+ <xsl:choose>
13696
+ <xsl:when test="normalize-space() != ''">
13697
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13698
+ <xsl:value-of select="$src_attachment"/>
13699
+ </xsl:when>
13700
+ <xsl:otherwise>
13701
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13702
+ <xsl:value-of select="$url"/>
13703
+ </xsl:otherwise>
13704
+ </xsl:choose>
13705
+ </xsl:attribute>
13706
+ <xsl:if test="$description != ''">
13707
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13708
+ </xsl:if>
13709
+ </pdf:embedded-file>
13674
13710
  </xsl:for-each>
13675
13711
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13676
13712
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13677
13713
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13678
13714
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13679
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
13680
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
13681
- <pdf:embedded-file src="{$url}" filename="{$filename_embedded}"/>
13715
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13716
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13717
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13718
+ <xsl:if test="$description != ''">
13719
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13720
+ </xsl:if>
13721
+ </pdf:embedded-file>
13682
13722
  </xsl:for-each>
13683
13723
  </xsl:if>
13684
13724
  </xsl:template> <!-- addPDFUAmeta -->
@@ -14056,7 +14096,14 @@
14056
14096
  <xsl:value-of select="$src"/>
14057
14097
  </xsl:when>
14058
14098
  <xsl:otherwise>
14059
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14099
+ <xsl:choose>
14100
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14101
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14102
+ </xsl:when>
14103
+ <xsl:otherwise>
14104
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14105
+ </xsl:otherwise>
14106
+ </xsl:choose>
14060
14107
  </xsl:otherwise>
14061
14108
  </xsl:choose>
14062
14109
  </xsl:template>