Give back parents per children
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 30
- Joined: Wed Feb 14, 2018 3:27 pm
Give back parents per children
Post by mariomueller »
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
-
- Posts: 30
- Joined: Wed Feb 14, 2018 3:27 pm
Re: Give back parents per children
Post by mariomueller »
Hi ,
I got a solution
returns:
Thanks
Regards
Mario
I got a solution
Code: Select all
//author!parent::book/path()
Code: Select all
/Q{}bookstore[1]/Q{}book[1]
/Q{}bookstore[1]/Q{}book[2]
/Q{}bookstore[1]/Q{}book[2]
/Q{}bookstore[1]/Q{}book[2]
/Q{}bookstore[1]/Q{}book[2]
Regards
Mario
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service