[thelist] XPATH - get only atrribute *values*

James Hardy evolt at weeb.biz
Fri Aug 5 10:22:08 CDT 2005


I am attempting to create an XPATH expression that will allow me to 
extract only the values of the specified attibutes using MSXML 4

Example

for this xml fragment
...
<LINK href="http://www.bbc.co.uk/">
	<TEXT>TV</TEXT>
</LINK>
<LINK href="http://www.cnn.com/">
	<TEXT>TV</TEXT>
</LINK>
<LINK href="http://www.aol.com/">
	<TEXT>ISP</TEXT>
</LINK>
<LINK href="http://www.demon.net/">
	<TEXT>ISP</TEXT>
</LINK>
<LINK href="http://www.five.tv/">
	<TEXT>TV</TEXT>
</LINK>
...

the XPath expression
//LINK[TEXT='TV']/@href
will return three element nodes with evaluate to the following strings

href="http://www.bbc.co.uk/"
href="http://www.cnn.com/"
href="http://www.five.tv/"

these name / value pairs are all well and good, however what I would 
like is to just have the following as text-nodes

http://www.bbc.co.uk/
http://www.cnn.com/
http://www.five.tv/

is there an expression I can use in XPath that will allow me to do this 
or should I just process the text after the event?

-- 
James Hardy



More information about the thelist mailing list