Add back testing files, lost in previous commit
[SXSI/xpathcomp.git] / tests / xpath-pt / xquery / F7.xql
diff --git a/tests/xpath-pt/xquery/F7.xql b/tests/xpath-pt/xquery/F7.xql
new file mode 100644 (file)
index 0000000..efc13b2
--- /dev/null
@@ -0,0 +1,15 @@
+declare namespace fun = 'have.more.fun';
+
+declare function fun:closure($input as node()*, $result as node()*) as node()*
+{
+   let $current := ($input | doc()//edge[@from = $input]/@to)
+   let $new := $current except $result 
+   let $all := ($result,$new) 
+   return
+      if(exists($new)) 
+      then ($new, fun:closure($new,$all))
+      else ()
+};
+
+doc()//category[@id="category0"]/@id/fun:closure(.,())/id(.)/name
\ No newline at end of file