Skip to Content
author's profile photo Former Member
Former Member

delete root node and content of node via XSLT

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2011 at 10:49 AM

    you can ignore the namespace which i can tell you for sure with the help of module adapter - XMLAnonymizerBean

    also give try to MessageTransformBean to ignore the root node.

    i hope this should help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2011 at 08:59 AM

    i changed the "copy" to this

     <xsl:copy-of select="node()" />
    

    and it works! thanks to everyone! :o)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.