From: Robert K. <ro...@ko...> - 2006-10-16 16:41:35
|
Hi, I don't know if this is eXist specific or general XQuery/XPath 2.0 (I would say I have a good deal of experience with XPath 1.0, but not XQuery and XPath2). I am using the latest from SVN as of this morning. The function below works when I use fn:doc, but not fn:collection. Questions: 1. Why doesn't fn:collection work? 2. Why do I need fn:string to get the value of the attribute for the link text? Is there a better way? If I don't use fn:string, the attribute is added to the a element as a copy (or doing <xsl:attribute../> in XSL 1.0). But the value of the attributes in the attribute-value-template(?) works as expected (like XPath1). Here is the function: declare function local:get-user-groups() as element()* { let $user-groups := xmldb:get-user-groups($user) for $user-group in $user-groups (:let $project-config := fn:collection(concat($ripple-db-uri, "/projects/", $user-group))/project.xml/*:) let $project-config := fn:doc(concat($ripple-db-uri, "/projects/", $user-group, "/project.xml"))/* return <li> <a href="#" onclick="submitForm('{$project-config/@id}', '{$project-config/@db-ref}')"> {fn:string($project-config/@label)} </a> </li> }; thanks, -Rob |