Skip to content

Commit

Permalink
xslt update based on metanorma/mn-native-pdf@d89756d
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Jul 29, 2024
1 parent 8760017 commit 46121c3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/isodoc/iec/iec.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -13032,6 +13032,17 @@
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
<xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
<xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
<xsl:value-of select="."/>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- add @id, mandatory for table auto-layout algorithm -->
<xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
<xsl:copy>
Expand Down Expand Up @@ -13906,7 +13917,8 @@
</xsl:when>
<xsl:otherwise>
<!-- _{filename}_attachments -->
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
<!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
</xsl:otherwise>
</xsl:choose>
Expand Down

0 comments on commit 46121c3

Please sign in to comment.