[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.com
Tue Oct 17 09:17:07 PDT 2006


  flowrrr - how to structure a function?
Michael Kay wrote:
> It looks reasonable to me. I'm not quite sure why you want the variable
> $is-valid, since it's only used once, but if you do want it then this is the
> way to write it.

I have rewritten to take into account David's suggestion and changed the 
way the code works, so it looks like:

declare function ep:enter-project($user as xs:string,
                                   $group-name as xs:string,
                                   $home-db-ref as xs:string?)
as element()? {
   if (ep:is-valid-user-for-group($user, $group-name)) then
     doc("databases.xml")/*/instance[@id=(
       if (not($home-db-ref=())) then $home-db-ref else 
request:get-parameter("db-ref", "")
     )]/
       (
         session:set-attribute("db-port", string(@port)),
         response:redirect-to(xs:anyURI("./project/"))
       )
   else
     <p class="warn">Could not find credentials to let you enter the 
project.</p>
};


> 
> Odd to see that this habit of sticking "fn:" in front of function names is
> catching on even with XSLTers. I never use it myself, it seems to achieve
> nothing but ugliness and redundancy. And inconsistency - you use doc() but
> fn:string(). But tastes vary...

I have removed all 'fn:'s and will never use it again :)

thanks,
-Rob



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.