I'm trying to transform an XML document and modify the attributes of single element but the transform is not getting applied if the root element has a namespace attribute. Simply removing xmlns works fine with my code.
My XML:
<?xml version="1.0"?> <BIDomain xmlns="http://www.oracle.com/biee/bi-domain"> <BIInstance name="coreapplication"> <SecurityOptions sslManualConfig="false" sslEnabled="false" ssoProvider="Custom" ssoEnabled="false"> <SecurityService> <EndpointURI>bisecurity/service</EndpointURI> </SecurityService> </SecurityOptions> </BIInstance> </BIDomain>
The XSL used:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" standalone="yes" /> <!-- Copying everything --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <!-- Add the new attributes --> <xsl:template match="SecurityOptions"> <xsl:copy> <xsl:attribute name="ssoProviderLogoffURL"/> <xsl:attribute name="ssoProviderLogonURL"/> <xsl:attribute name="sslVerifyPeers"> <xsl:value-of select="'false'" /> </xsl:attribute> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
The end result is the same XML. If I remove the namespace definition from the root element <BIDomain xmlns="http://www.oracle.com/biee/bi-domain">
the transform gets applied normally. I'm assuming that I'm doing something wrong and the namespace attribute is interfering with the matching.
Any ideas?