XQuery > Getting ancestors

Hello there,

I’m trying to accomplish the following : getting ancestors of a Node with an XQuery.

Let’s say that I have the following structure :

..... 007 .....

A Book can contain any number of Section (recursive) and a Section ends with an Article. Each Article has a unique ID (eg 007).

I want to get the Axis/Path of ALL ancestors (Book & Section & their attributes) of an Article (given its id).
ie : filtering out all Section which does not contain Article 007
eg :

007

Is it possible with an XQuery ?

Thanks.

Hi,

I’m afraid with Tamino 4.2 it is not possible to query the ancestors of a node, since the according navigation axis is not supported.
In the upcoming Tamino version this will change.

Best Regards,

Thorsten Fiebig

Hi MartelB

very simple:

{ for $s in input()/Book/Section where $s//Article="001" return $s }

Regards,

Joachim