@@ -13413,26 +13413,37 @@
13413
13413
</x:xmpmeta>
13414
13414
<!-- add attachments -->
13415
13415
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13416
- <xsl:choose>
13417
- <xsl:when test="normalize-space() != ''">
13418
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'( | | )', '')"/> <!-- remove line breaks -->
13419
- <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13420
- </xsl:when>
13421
- <xsl:otherwise>
13422
- <!-- _{filename}_attachments -->
13423
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13424
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13425
- <pdf:embedded-file src="{$url}" filename="{@name}"/>
13426
- </xsl:otherwise>
13427
- </xsl:choose>
13416
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13417
+
13418
+ <pdf:embedded-file filename="{@name}">
13419
+ <xsl:attribute name="src">
13420
+ <xsl:choose>
13421
+ <xsl:when test="normalize-space() != ''">
13422
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'( | | )', '')"/> <!-- remove line breaks -->
13423
+ <xsl:value-of select="$src_attachment"/>
13424
+ </xsl:when>
13425
+ <xsl:otherwise>
13426
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13427
+ <xsl:value-of select="$url"/>
13428
+ </xsl:otherwise>
13429
+ </xsl:choose>
13430
+ </xsl:attribute>
13431
+ <xsl:if test="$description != ''">
13432
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13433
+ </xsl:if>
13434
+ </pdf:embedded-file>
13428
13435
</xsl:for-each>
13429
13436
<!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13430
13437
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13431
13438
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13432
13439
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13433
13440
<xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13434
- <!-- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/> -->
13435
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}"/>
13441
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13442
+ <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13443
+ <xsl:if test="$description != ''">
13444
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13445
+ </xsl:if>
13446
+ </pdf:embedded-file>
13436
13447
</xsl:for-each>
13437
13448
</xsl:if>
13438
13449
</xsl:template> <!-- addPDFUAmeta -->
0 commit comments