I do the:
<xsl:copy-of select="ancestor-or-self::node()"/>
and it pulls in the input XML file exactly like I want EXCEPT that the envelope tag is missing...
If you look at my input XML and the output, you will notice that the "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org..." line is missing from the output. Why is this? How do I rectify this?
Here is the input XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<bea:RouterService xmlns:bea="http://www.bea.com/servers/wls70/samples/examples/webservices/basic/statelessSession">
<string xsi:type="xsd:string">ABCDEFG</string>
</bea:RouterService>
</soapenv:Body>
</soapenv:Envelope>
and here is my xslt
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:copy-of select="ancestor-or-self::node()"/>
</xsl:template>
</xsl:stylesheet>
and here is my output
Code:
<?xml version="1.0" encoding="utf-8"?><string><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<bea:RouterService xmlns:bea="http://www.bea.com/servers/wls70/samples/examples/webservices/basic/statelessSession">
<string xsi:type="xsd:string">XDO267A61897</string>
</bea:RouterService>
</soapenv:Body>
</soapenv:Envelope></string>