searching in xml file..

Posted by Gopal_nivas under ASP.NET on 9/20/2010 | Points: 10 | Views : 1192 | Status : [Member] | Replies : 2
hi..
i have xml file like this..
<a url="www.google.com" text"google">
<b url="www.gmail.com" text"gmail">
<c url="www.yahoo.com" text"yahoo"></c></b>
</a>


in tat i want to search parent node of the child..

in this example i have 2 parents for the sub child c..

so if i give the word of the sub child textie)text="yahoo"..

then it will find and give the output of its parent url i.e)www.google.com,
www.gmail.com..

so like tat it goes..

so how to to this..

plz explain with examples..

need ur suggestions..
regards
gopal.s




Responses

Posted by: Vikas413 on: 9/20/2010 [Member] Starter | Points: 25

Up
0
Down
Hi Gopal,

you need to go by hirerchy, means first find parent node 'b' and then grand parent node 'a'

to get parent node you can use following expressions

<xsl:value-of select="parent::node"/> : selects all parent elements that have name node.
Or
<xsl:value-of select="parent::node()"/>
Or
<xsl:value-of select=".."/>

Try these out and let me know ;)
Vikas

Regards,
Vikas Patel.

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopal_nivas on: 9/20/2010 [Member] Starter | Points: 25

Up
0
Down
hi vikas..

plz explain me with an example..



regards
gopal.s

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response