Skip to content

Commit 8a5c494

Browse files
xslt update based on metanorma/mn-native-pdf@75ed94d
1 parent 17354f8 commit 8a5c494

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

lib/isodoc/plateau/plateau.international-standard.xsl

+25-14
Original file line numberDiff line numberDiff line change
@@ -13413,26 +13413,37 @@
1341313413
</x:xmpmeta>
1341413414
<!-- add attachments -->
1341513415
<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(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- 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(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- 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>
1342813435
</xsl:for-each>
1342913436
<!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
1343013437
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
1343113438
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
1343213439
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
1343313440
<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>
1343613447
</xsl:for-each>
1343713448
</xsl:if>
1343813449
</xsl:template> <!-- addPDFUAmeta -->

0 commit comments

Comments
 (0)