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 authored Jul 29, 2024
1 parent 624ff97 commit b17d355
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion lib/isodoc/m3aawg/m3aawg.policy.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11348,6 +11348,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 @@ -12222,7 +12233,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
14 changes: 13 additions & 1 deletion lib/isodoc/m3aawg/m3aawg.report.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11348,6 +11348,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 @@ -12222,7 +12233,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 b17d355

Please sign in to comment.