XPath query
Added by Anonymous over 14 years ago
Legacy ID: #8619822 Legacy Poster: https://www.google.com/accounts ()
Hello, I'm using Saxon 9.2 and I'm wondering whether the following XPath query is possible - please consider the following: 123 Value<'data> 123 Value2 If I evaluate a query on the element, how can I retrieve the value of the ref attribute on the first node? The following won't parse - is such a query even possible? /import/record[id/text()=parent/text()]@ref Thanks, JB
Replies (2)
RE: XPath query - Added by Anonymous over 14 years ago
Legacy ID: #8620171 Legacy Poster: Michael Kay (mhkay)
Please note that this forum is intended for questions and comments that are specific to Saxon. For general XPath programming advice, a better place is the xsl-list at mulberrytech.com. I don't really know the answer. Your English-language description of the problem refers to ref="efg" which isn't present in your source document. Your (incorrect) XPath expression can most easily be corrected to /import/record[id = current()/parent]/@ref but that assumes you're in XSLT and current() is the the ref="def" element.
RE: XPath query - Added by Anonymous over 14 years ago
Legacy ID: #8620209 Legacy Poster: https://www.google.com/accounts ()
Thanks for your response, and apologies for using the wrong forum. I did mean ref="def" in my description, so you are correct in assuming current is equal to that node. I note with interest that you write: id = current()/parent and not: id/text() = current()/parent/text() The former being a shorthand for the latter, I assume? So, is this something that is supported with Saxon's XPath implementation assuming I am executing an XPath query against a DOM? There's no XSLT in play.. JB
Please register to reply