@@ -19726,26 +19726,37 @@
19726
19726
</x:xmpmeta>
19727
19727
<!-- add attachments -->
19728
19728
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
19729
- <xsl:choose>
19730
- <xsl:when test="normalize-space() != ''">
19731
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(
|
|
)', '')"/> <!-- remove line breaks -->
19732
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"/>
19733
- </xsl:when>
19734
- <xsl:otherwise>
19735
- <!-- _{filename}_attachments -->
19736
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
19737
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
19738
- <pdf:embedded-file src="{$url}" filename="{@name}" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"/>
19739
- </xsl:otherwise>
19740
- </xsl:choose>
19729
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
19730
+
19731
+ <pdf:embedded-file filename="{@name}" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
19732
+ <xsl:attribute name="src">
19733
+ <xsl:choose>
19734
+ <xsl:when test="normalize-space() != ''">
19735
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(
|
|
)', '')"/> <!-- remove line breaks -->
19736
+ <xsl:value-of select="$src_attachment"/>
19737
+ </xsl:when>
19738
+ <xsl:otherwise>
19739
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
19740
+ <xsl:value-of select="$url"/>
19741
+ </xsl:otherwise>
19742
+ </xsl:choose>
19743
+ </xsl:attribute>
19744
+ <xsl:if test="$description != ''">
19745
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
19746
+ </xsl:if>
19747
+ </pdf:embedded-file>
19741
19748
</xsl:for-each>
19742
19749
<!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
19743
19750
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
19744
19751
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
19745
19752
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
19746
19753
<xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
19747
- <!-- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/> -->
19748
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"/>
19754
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
19755
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
19756
+ <xsl:if test="$description != ''">
19757
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
19758
+ </xsl:if>
19759
+ </pdf:embedded-file>
19749
19760
</xsl:for-each>
19750
19761
</xsl:if>
19751
19762
</xsl:template> <!-- addPDFUAmeta -->
0 commit comments