Jump to content

XPath to filter childnodes returned


DominicWatson

Recommended Posts

Is it possible to create an XPath expression to filter the child nodes that get returned with each node result? For example: say I have a node that looks like this (in xml):

<element id="1">	<name>blah</name>	<description>blah blah</description>	<other>blah</other>	<other>blah1</other>	<other>blah2</other></element>

I'd like an XPath expression to return a node result like this (the 'filter' saying I only want the 'name' child included):

<element id="1">	<name>blah</name></element>

Can it be done?!Thanks in advance,Dom

Link to comment
Share on other sites

No. Not in XPath 1.0 anyway. XPath 2.0 and XQuery allow that. I'm not (yet) sure how it's done in either though, but I'm sure they allow it, considering XQuery is almost as powerful as XSLT.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...