Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2009, 11:25 PM
Authorized User
 
Join Date: Apr 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to remove remove elements deep using xsl

Hi all,
I am new to XSLT .can anyone pls help me in the below query.I need to remove uncessary elements from my xml. I checked out a couple of functions but not sure how to use it.Eg: functx:remove-elements-deep

Existing 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:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode 
xmlns:p377="http://complextypes.app.esb.bac.com">p377:FaultException</faultcode>
<faultstring>
<faultcode>Client.KeyNotFoundException</faultcode>
<faultstring>Record not Found</faultstring>
<faultactor>APP</faultactor>
<detail>
<osaFaultDetail>
<traceId>EF54DF6A4CCE-58365984</traceId>
<component>Ret</component>
<service>
<name>Retr</name>
<operation>Retr</operation>
<version>V001</version>
</service>
<serverInstance>XXX</serverInstance>
<timestamp>2009-04-27T21.47.38</timestamp>
<request>RetRequest</request>
</osaFaultDetail>
</detail>
</faultstring>
<detail encodingStyle="">
<p377:FaultException 
xmlns:p377="http://complextypes.app.esb.bac.com">
<p377:faultcode>Client.KeyNotFoundException</p377:faultcode>
<p377:faultstring>Record not Found</p377:faultstring>
<p377:faultactor>APP</p377:faultactor>
<p377:osaFaultDetail>
<p377:traceId>EF54DF6A4CCE-58365984</p377:traceId>
<p377:component>Ret</p377:component>
<p377:service>
<p377:name>Retr</p377:name>
<p377:operation>Retr</p377:operation>
<p377:version>V001</p377:version>
</p377:service>
<p377:serverInstance>XXX</p377:serverInstance>
<p377:timestamp>2009-04-28T02:47:38.148Z</p377:timestamp>
<p377:request>RetRequest</p377:request>
</p377:osaFaultDetail>
</p377:FaultException>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Required 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:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode 
xmlns:p377="http://complextypes.app.esb.bac.com">p377:FaultException</faultcode>
<faultstring>
<faultcode>Client.KeyNotFoundException</faultcode>
<faultstring>Record not Found</faultstring>
<faultactor>APP</faultactor>
<detail>
<osaFaultDetail>
<traceId>EF54DF6A4CCE-58365984</traceId>
<component>Ret</component>
<service>
<name>Retr</name>
<operation>Retr</operation>
<version>V001</version>
</service>
<serverInstance>XXX</serverInstance>
<timestamp>2009-04-27T21.47.38</timestamp>
<request>RetRequest</request>
</osaFaultDetail>
</detail>
</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
 
Old May 5th, 2009, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

Try this:
Code:
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"></xsl:copy-of>
<xsl:apply-templates></xsl:apply-templates>
</xsl:copy>
</xsl:template>

<xsl:template match="detail[@encodingStyle]"></xsl:template>
__________________
Rummy





Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove orphaned html elements from html string pauliehaha C# 2008 aka C# 3.0 2 June 30th, 2008 09:40 AM
How to remove numbers in XML files using xsl srkumar XSLT 1 April 15th, 2008 06:43 AM
remove empty elements but not ones with attributes dupdup XSLT 1 March 3rd, 2007 07:02 PM
How to remove all elements of select in JavaScript Edward King Javascript How-To 1 August 14th, 2004 05:11 AM
How to remove ? abdusalam Javascript How-To 1 July 27th, 2004 01:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.