I am trying to remove the attribute xmlns="http://webdev2003.test.com"
from the following xml using xsl/xslt, a requirement of the XML Task in SSIS. What is a proper methodology considering a large file size. ~40mb
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfAccount xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Account>
<FirstName xmlns="http://webdev2003.test.com/">John</FirstName>
<LastName xmlns="http://webdev2003.test.com/">Smith</LastName>
</Account>
</ArrayOfAccount>
I hate when I answer my own questions, but the credit goes to - http://blogs.msdn.com/kaevans/archive/2003/06/13/8679.aspx
The first part of the example lists how to remove all attributes which in my scenario works. Perhaps there is a better solution?
I think you can remove the namespace declarations as described in this article. It looks like you might have to declare a prefix for the namespace in your stylesheet before adding it to the exclude-result-prefixes attribute.
You can prevent this from happening with the xsl:stylesheet element's exclude-result-prefixes attribute. This attribute's name can be confusing, because the namespace prefixes will still show up in the result tree. It doesn't mean "exclude the prefixes in the result"; it means "exclude the namespaces with these prefixes".
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