Give back parents per children
Posted: Mon Jul 23, 2018 11:29 am
Hi ,
I have a XML like
When I evaluate the XPATH I get the result:
But as the second <book> has three <author>-nodes I am searching for a XPATH expression that gives me back the following:
Is this possible?
Thanks
Regards
Mario
I have a XML like
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>Vaidyanathan Nagarajan</author>
</book>
<book category="it" cover="paperback">
<title lang="en">Learning XML</title>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
When I evaluate the XPATH
Code: Select all
/bookstore/book/author/parent::book
Code: Select all
XPath Location: /bookstore[1]/book[1]
XPath Location: /bookstore[1]/book[2]
Code: Select all
XPath Location: /bookstore[1]/book[1]
XPath Location: /bookstore[1]/book[2]
XPath Location: /bookstore[1]/book[2]
XPath Location: /bookstore[1]/book[2]
Thanks
Regards
Mario