Skip to content

Commit

Permalink
xslt update based on metanorma/mn-native-pdf@ac24692
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 authored Aug 28, 2024
1 parent 94d679f commit d936e22
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 10 additions & 4 deletions lib/isodoc/iho/iho.specification.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6993,6 +6993,12 @@
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
<attachment filename="{@name}"/>
</xsl:for-each>
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
<attachment filename="{$attachment_path}"/>
</xsl:for-each>
</xsl:if>
</xsl:variable>
<xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>

Expand All @@ -7005,7 +7011,7 @@
<xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
</xsl:when>
<!-- link to the PDF attachment -->
<xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
<xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
<xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
</xsl:when>
<!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
Expand Down Expand Up @@ -12528,9 +12534,9 @@
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
<xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
<xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
<!-- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/> -->
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}"/>
</xsl:for-each>
</xsl:if>
</xsl:template> <!-- addPDFUAmeta -->
Expand Down
14 changes: 10 additions & 4 deletions lib/isodoc/iho/iho.standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6993,6 +6993,12 @@
<xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
<attachment filename="{@name}"/>
</xsl:for-each>
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
<attachment filename="{$attachment_path}"/>
</xsl:for-each>
</xsl:if>
</xsl:variable>
<xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>

Expand All @@ -7005,7 +7011,7 @@
<xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
</xsl:when>
<!-- link to the PDF attachment -->
<xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
<xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
<xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
</xsl:when>
<!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
Expand Down Expand Up @@ -12528,9 +12534,9 @@
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
<xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
<xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
<xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
<!-- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/> -->
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}"/>
</xsl:for-each>
</xsl:if>
</xsl:template> <!-- addPDFUAmeta -->
Expand Down

0 comments on commit d936e22

Please sign in to comment.