Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

xmlnode no child nodes

Posted on 2004-10-04
5
Medium Priority
?
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 1000 total points
ID: 12221829
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
ID: 12237395
can we get the same with xpath query without using xsl.
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12240894
No
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

721 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