Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Select nodes from XML document using contain >Thread Next - Re: Select nodes from XML document using contain Re: Select nodes from XML document using containTo: NULL Date: 3/1/2007 2:18:00 PM johnsmithme2004@y... wrote: > I have run the XPath on the document, but it looks like it returns the > childnodes of a parent where Role contains 'Admin'. > I just want it to return only the nodes (in correct hierarchy and > order) where the Role contains 'Admin'. If a child contains 'Admin' > and a parent does not then I do not want it to return anything. Your example XML input posted looks like this <siteMap> <siteMapNode title="Chapter 1" url="~/chapter1.aspx" roles="Admin, All, Agent, Editor"> <siteMapNode title="Page 1" url="~/page1.aspx" roles="Admin"/> </siteMapNode> <siteMapNode title="Chapter 2" url="~/chapter2.aspx" roles="All, Admin, Agent, Editor"> <siteMapNode title="Page 1" url="~/page1.aspx" roles="Admin"/> <siteMapNode title="Page 2" url="~/page2.aspx" roles="Editor"/> </siteMapNode> </siteMap> Please show the resulting XML you want to generate, it is currently not clear to me what you want to achieve. The XSLT stylesheet I posted will yield this result: <siteMap> <siteMapNode title="Chapter 1" url="~/chapter1.aspx" roles="Admin, All, Agent, Editor"> <siteMapNode title="Page 1" url="~/page1.aspx" roles="Admin"/> </siteMapNode> <siteMapNode title="Chapter 2" url="~/chapter2.aspx" roles="All, Admin, Agent, Editor"> <siteMapNode title="Page 1" url="~/page1.aspx" roles="Admin"/> </siteMapNode> </siteMap> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
