Skip to Content
0
Former Member
Nov 18, 2011 at 10:41 AM

delete root node and content of node via XSLT

798 Views

Is it possible to delete a root node and contents, but leave the remaining xml via xslt??

i receive this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
 <!-- 
 XML Validation Inbound Channel Response 
  --> 
 <ser-root:createContractResponse xmlns:ser-root="http://host/ws/createContract" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns:BBP_ES_OA_UPDATE.Response xmlns:ns="urn:sap-com:document:sap:rfc:functions">
<CROSSREF>
  <ES_MA_NUMBER>contracts.Contract:MA-ICE-00000190</ES_MA_NUMBER> 
  <ES_DOC_TYPE>CTR</ES_DOC_TYPE> 
  <ES_MA_NAME>Test 1611-a</ES_MA_NAME> 



</ns:BBP_ES_OA_UPDATE.Response>
    </ser-root:createContractResponse>

but want to delete the ser-root:createContractResponse and namespaces within and leave the ns:BBP_ES_OA_UPDATE...

i had come up with this.,,,

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="results">
        <xsl:copy>
            <xsl:apply-templates select="ser-root:createContractResponse /*"/>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

but this does not work for me! any ideas?