Guest chetrity Posted June 8, 2006 Share Posted June 8, 2006 hi,simple question I guess but I couldn't find the answer...How to extract the value of an attribute using xPath?for example, lets say this is the xml:<root> <classes> <class> <lesson id="55" /> <lesson id="66" /> <lesson id="88" /> </class > </classes></root>and I want the output to be :556688so the path should be: ...xmlDoc.selectNodes(/classes/class/lesson/???)and I dont know what should be instead of the ???(@id will bring back: id="55" while I need only 55)Thanks Link to comment Share on other sites More sharing options...
boen_robot Posted June 9, 2006 Share Posted June 9, 2006 How about enclosing the whole expression in a string function like this: xmlDoc.selectNodes(string(/root/classes/class/lesson/@id)) Or perhaps there is another object to select only the content of the targeted element? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now