Posted By: VB Man | Sep 29th @ 9:11 PM
page 1 of 1
Comments: 4 | Views: 419
VB Man
VB Man
Blah.
HI ALL. I have the following element:

<child firstname="smith" age="10" dayborn="19"/>

How can I extract the age of the child using XPath?

Much thanks.


Sven Groot
Sven Groot
You can't have everything; after all, where would you put it?
If for example you want to select it by firstname:

//child[@firstname='smith']/@age

(Note that this searches all child elements in the document. You might want something more precise than using // at the start)
Sven Groot
Sven Groot
You can't have everything; after all, where would you put it?
Well, that's obviously not going to match the element from your original post since that child is 10, which is not less than 10.

A little more context would be nice, such as the entire XML document and style sheet.
page 1 of 1
Comments: 4 | Views: 419