Solved

xmlnode no child nodes

Posted on 2004-10-04
5
196 Views
Last Modified: 2006-11-17
Hi
here is my xml document and want to get the Persons node with out Address node.

i mention the output format.
Can anybody have clue,please help me.

Ex:

<Persons>
      <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            <Address>
                  <Line1></Line1>
                  <Line2></Line2>
            </Address>
            </Person>
            <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            <Address>
                  <Line1></Line1>
                  <Line2></Line2>
            </Address>
            </Person>
            <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            <Address>
                  <Line1></Line1>
                  <Line2></Line2>
            </Address>
            </Person>
</Persons>

OuPut :

<Persons>
      <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            
            </Person>
            <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            
            </Person>
            <Person>
            <FirstName></FirstName>
            <LastName></LastName>
            
            </Person>
</Persons>
0
Comment
Question by:pprasadravi
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 250 total points
Comment Utility
Try that xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
 <Persons>
 <xsl:apply-templates/>
 </Persons>
 </xsl:template>
 <xsl:template match="Person">
 <Person>
 <xsl:copy-of select="child::*[name() != 'Address']"/>
 </Person>
 </xsl:template>

</xsl:stylesheet>
0
 

Author Comment

by:pprasadravi
Comment Utility
can we get the same with xpath query without using xsl.
0
 
LVL 19

Expert Comment

by:ramazanyich
Comment Utility
No
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now