declare function local:GetParentIDByID($cls_id)
{//XMI/XMI.content/UML:Model/UML:Namespace.ownedElement//UML:Generalization/UML:Generalization.child/UML:Class[@xmi.idref=$cls_id]/../../UML:Generalization.parent/UML:Class/@xmi.idref};
declare function local:GetAnsc($cls_id,$chs)
{
if ($cls_id = ()) then $chs else
for $r in $cls_id
let $j := local:GetParentIDByID($r)
let $chn := $chs | $j
return $chn | local:GetAnsc($j,$chn )
};
declare function local:DIT($cls_id) {count(local:GetAnsc($cls_id,()))+1};
Hi Mohamed,
thanks for the report; the error you get is indeed caused by a bug in our
processor (it assumes that the default type of a parameter in a
user-defined function is item() instead of item()*, so you get an error
when you pass the empty sequence value).
The fix for this bug will be in the next update of Stylus; in the
meanwhile, you can work around it by changing the definitions of the two
functions to be
declare function local:GetParentIDByID($cls_id as item()*)
and
declare function local:GetAnsc($cls_id as item()*,$chs as item()*)