I have the following XML which can appear in either form in my XML Document:
<Message xsi:schemaLocation="http://www.location.com StructureFile.xsd" xmlns=http://www.thenamespace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
or
<Message xmlns="http://www.thenamespace.com">
and I need the output to be:
<Message xmlns="http://www.theNEWnamespace.com">
I currently have this template to handle the shorter version of the two xml possibilities:
<xsl:template match="*">
<xsl:element name="{name()}" namespace="http://www.theNEWnamespace.com">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
However this does not remove the SchemeLocation or xmlns:xsi parts of the xml if they are in existance.
How would I go about adapting the above to handle both possibilities.
Cheers,
Edit: XML structure:
<?xml version="1.0" encoding="utf-8"?>
<Message xsi:schemaLocation="http://www.location.com StructureFile.xsd" xmlns="http://www.thenamespace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<Info></Info>
</Header>
</Message>
Here is a complete transformation producing the wanted result:
When this transformation is applied on the following XML document (none provided!):
the wanted, correct result is produced: