Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Select nodes from XML document using contain

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent