[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Selecting the node which have child without repiti

Subject: Re: Selecting the node which have child without repition
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Fri, 19 Nov 2010 09:29:34 +0530
Re:  Selecting the node which have child without repiti
The following XPath expression seem to work:

//b[c][not(@name = following::b[c]/@name)]

On Thu, Nov 18, 2010 at 11:05 PM, Rashi Bhardwaj
<rashi.bhardwaj@xxxxxxxxx> wrote:
> Hi all,
>
> I am facing a problem while selecting a node through xpath....please help me
out
>
> Here is the input xml
>
> <test>
> B  <a>
> B  B <b name ='1'></b>
> B  B <b name ='2'></b>
> B  B <b name ='3'>
> B  B  B  B  <c></c>
> B  B </b>
> B  B <b name ='4'>
> B  B  B  B <c></c>
> B  B  B  B <c></c>
> B  B </b>
> B </a>
> B <a>
> B  <b name ='1'></b>
> B  <b name ='2'>
> B  B  B <c></c>
> B  </b>
> B  <b name ='3'></b>
> B  <b name ='4'>
> B  B  <c></c>
> B  </b>
> B </a>
> </test>
>
> Xpath:
> //b[child::c][not(./@name=following-sibling::b/@name)]
>
> Output:
> b name="3"
> b name="4"
> b name="2"
> b name="4"
>
> What I want is to select all 'b' that have child 'c', provide the 'b'
> with same '@name' which are selected first should not be selected
> further.
>
> Desired output:
>
> Output:
> b name="3"
> b name="4"
> b name="2"
>
> As b with @name = 4 has already been searched, it should not come
> again in search.
>
> Please help me .....thanks a lott....
>
> Rashi




--
Regards,
Mukul Gandhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.