Below is my xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ms="http://www.test.com/schemas/test"
xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="ms ns">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<XMLResponse>
<xsl:apply-templates select="ms:ProductRS/ms:Product"/>
</XMLResponse>
</xsl:template>
<-- some templates here -->
</xsl:stylesheet>
In the output i getting like below
<?xml version="1.0" encoding="UTF-16"?>
<XMLResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Product>-----</Product>
</XMLResponse>
I need to remove xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
from the xml output
The removeAttributeNS() method removes an attribute specified by namespace and name.
The XSLTRANSFORM command converts the XML document using the first XSLT stylesheet and returns the following XML with all the namespace information removed.
Once a namespace prefix is created, it cannot be changed or deleted. The workaround is to move all your code to a new Developer Organization, where you can setup the desired Namespace Prefix.
To exclude a namespace then you should represent this way:-
exclude-result-prefixes="ms ns xsi
"
Basically your stylesheet looks like this:-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ms="http://www.test.com/schemas/test"
xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="ms ns xsi">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With