XPath query

  • Anonymous - 2010-09-06


    I'm using Saxon 9.2 and I'm wondering whether the following XPath query is
    possible - please consider the following:

    <record ref="abc">
    <record ref="def">

    If I evaluate a query on the <record ref="efg"> element, how can I retrieve
    the value of the ref attribute on the first <record> node? The following won't
    parse - is such a query even possible?




  • Michael Kay

    Michael Kay - 2010-09-06

    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/@ref but that assumes you're in XSLT and current() is the the
    ref="def" element.

  • Anonymous - 2010-09-06

    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



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks