|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] flowrrr - how to structure a function?Robert Koberg rob at koberg.comTue Oct 17 07:16:24 PDT 2006
Hi, (I am a newbie) Is it appropriate (necessary?) to nest return statements. Is there a better way to write the function below? I only want to get the $db-ref string and $db-instance nodeset 'if the user is valid'. ------------------------------- declare function local:enter-project() as element()? { let $is-valid := local:is-valid-user-for-group() return if ($is-valid) then let $db-ref := request:get-parameter("db-ref", ""), $db-instance := doc(databases.xml")/*/instance[@id=$db-ref] return ( session:set-attribute("rest-db-uri", fn:string($db-instance/rest-uri)), session:set-attribute("xmlprc-db-uri", fn:string($db-instance/xmlprc-uri)), session:set-attribute("webdav-db-uri", fn:string($db-instance/webdav-uri)), session:set-attribute($project-key, $group-name), response:redirect-to(xs:anyURI("./project/")) ) else <p class="warn">Could not find credentials to let you enter the project.</p> }; thanks, -Rob
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






