Grzesiek23
asked on
Select parent nodes in XML
I wrote the xmld code below.
I want to get all the parent nodes by entering specify URL as parameter.
I mean - I have the category ID = 17, so the url will be:
"~/forum-c-17"
Now I want to select this element (ID, title) and also parent nodes, so:
- "~/forum" | Strona glowna forum
---- "~/forum-c-11" | Gospodarka
-------- "~/forum-c-17" | PKO BP
How can I do this?
After get it I need to format these elements iinto string with anchors links.
I want to get all the parent nodes by entering specify URL as parameter.
I mean - I have the category ID = 17, so the url will be:
"~/forum-c-17"
Now I want to select this element (ID, title) and also parent nodes, so:
- "~/forum" | Strona glowna forum
---- "~/forum-c-11" | Gospodarka
-------- "~/forum-c-17" | PKO BP
How can I do this?
After get it I need to format these elements iinto string with anchors links.
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/forum" title="Strona glowna forum">
<siteMapNode url="~/forum-c-1" title="Ogólne"/>
<siteMapNode url="~/forum-c-3" title="Spoleczenstwo"/>
<siteMapNode url="~/forum-c-4" title="Wojsko"/>
<siteMapNode url="~/forum-c-5" title="Parlament"/>
<siteMapNode url="~/forum-c-6" title="Rzadowe dyskusje"/>
<siteMapNode url="~/forum-c-7" title="Uwagi i propozycje do administracji"/>
<siteMapNode url="~/forum-c-8" title="Wojsko Polskie"/>
<siteMapNode url="~/forum-c-10" title="Informacje"/>
<siteMapNode url="~/forum-c-11" title="Gospodarka">
<siteMapNode url="~/forum-c-17" title="PKO BP"/>
</siteMapNode>
<siteMapNode url="~/forum-c-12" title="Polityka">
<siteMapNode url="~/forum-c-14" title="Kandydatury"/>
</siteMapNode>
<siteMapNode url="~/forum-c-13" title="Moderatorzy"/>
</siteMapNode>
</siteMap>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
p.s. I removed the namespace from the sample XML to make it work as is. If you want to support namespaces you will have to refer to the particular XPATH implementation on how to do it.