Hi An,

the root function returns the root of the tree to which the current node belongs, usually be a document node. You can retrieve the attribute according to your root element e.g. by $otx/ROOT_ELEMENT/@package, where ROOT_ELEMENT ist the root element of your document.

Lukas


2011/11/21 Truong An Nguyen <ngtruongan@gmail.com>
Hi,

In my xquery, I use the root() function to return the root element of an element. I could get the root element,  but I couldn't get any attributes of it.

For example: 
for $value in collection()/otx/imports/import
let $otx:=root($value)                         
return $otx/@package

Thanks

Cheers,
An

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk