Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xslt update based on metanorma/mn-native-pdf@ac2469204a480090446b8222eed0f3c6dd7d4560 #240

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/isodoc/m3aawg/m3aawg.policy.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6742,6 +6742,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 @@ -6754,7 +6760,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 @@ -12291,9 +12297,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/m3aawg/m3aawg.report.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6742,6 +6742,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 @@ -6754,7 +6760,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 @@ -12291,9 +12297,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
Loading