Unwanted namespace not being excluded
Posted: Sat Jan 07, 2017 1:37 am
Hi all,
I'm doing an XML-to-XML transformation via XSLT 2.0, and a namespace declaration from my source document is appearing in my output despite my adding it to the exclude-result-prefixes list. I'm relatively new to XSLT, so I'm not sure if I've misunderstood how to use the exclude-result-prefixes attribute, or I'm using Oxygen incorrectly, or if there's a bug.
My input document is an instance of NLM Journal Publishing 3.0, which looks like this in abbreviated form:
I'm converting to an instance of JATS, and I want to remove the "atict" namespace declaration from the <article> element (and its descendants).
I'm starting with a very simple spreadsheet:
In my output, the children of <article> (<front> and <body>) both have the "atict" namespace declaration.
What am I missing?
I'm doing an XML-to-XML transformation via XSLT 2.0, and a namespace declaration from my source document is appearing in my output despite my adding it to the exclude-result-prefixes list. I'm relatively new to XSLT, so I'm not sure if I've misunderstood how to use the exclude-result-prefixes attribute, or I'm using Oxygen incorrectly, or if there's a bug.
My input document is an instance of NLM Journal Publishing 3.0, which looks like this in abbreviated form:
Code: Select all
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "journalpublishing3.dtd">
<article article-type="research-article" dtd-version="3.0" xml:lang="en"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atict="http://www.arbortext.com/namespace/atict">
<front>...</front>
<body>...</body>
</article>
I'm starting with a very simple spreadsheet:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:atict="http://www.arbortext.com/namespace/atict"
exclude-result-prefixes="atict xs"
version="2.0">
<xsl:output method="xml"/>
<xsl:template match="article">
<article article-type="research-article" xml:lang="en" dtd-version="1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:apply-templates/>
</article>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
What am I missing?