I have the following
url :  &author=TOM

I have xqy function that places this into an element params.
let $params := <params><author>TOM</author></params>

I use this variable as such

let $a := if (fn:boolean($params/author/text())) then $params/author/text() 
else ""
return myfunc:hi($a)

The above variable is tested because of the following:
define function myfunc:hi($a as xs:string)
This will through exception if $a is empty.

Would this be considered good practice/best practice.
I have other ideas:

myfunc:hi($as as xs:string?)
and alter function if needed

create new function
myfunc:init-params($params as element(params))
and initialize all variables  here

thoughts, experience, caveats ?
/text()
empty variable
strings

etc...




      
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to