I managed to figure out the query by trial and error which will return the result that I was looking for
Follwing is the query:
define function recurse(element $cap, xs:string $leaf_id ) returns element{
if (string($leaf_id) = string($cap/@id))
then
<Capability>
{$cap/@id, $cap/name, $cap/priority}
<siblings>{count($cap/../Capability)}</siblings>
</Capability>
else
for $child in $cap/collection/Capability
let $e := recurse($child, $leaf_id)
return if(empty($e)) then ()
else
<Capability>
{$cap/@id, $cap/name, $cap/priority}
<siblings>{count($cap/../Capability)}</siblings>
{$e}
</Capability>
}
define function ROI_Query($root_id, $leaf_id, $file){
for $capability in document($file)/Hierarchy//Capability where $capability/@id = $root_id
return recurse($capability, $leaf_id)
}
Question:
When will Tamino support these kinds of queries?
I am currently using a Java wrapper arround Quip to perform this query on data from Tamino. It sorta defeats the purpose of the Java Tamino API, but this is the only way I have be able to achieve the results that I needed. It would be realy nice if Tamino had a way to define user functions.
Another Question:
How are function in the tf: namespace defined. They haveto be implemeted somewhere. Going down that route, would one be able to define some functions and make them availble thourgh the Tamino XQuery interface?
Thanks
–joeycz
X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k
WebContainer : Tomcat 4.1.24
JDK Version : 1.4.1
#API-Management#Tamino#webMethods