[xquery-talk] If Statements within an If Statement?

David Carlisle davidc at nag.co.uk
Wed Apr 2 23:23:12 PST 2008



declare function local:main($search as xs:anyAtomicType*) as element()*
{
let $search := upper-case(request:get-parameter("search", ""))


this makes no sense, it's legal but so is writing 1+1-2 instead of 0.

Doing the above means that the argument to the function can never be
used, so why not declare it as a function with no arguments?

You defined $search as a function parameter then immediately mask that
with a new ariable of the same name, which makes the function parameter
inaccessible.


local:searchresult declares variables $a and $b which it never uses

for $doc in distinct-values($seq)

looks very suspiciou as well, do you really want to be basing your
sorting and uniquenes stests on the entire text of the elements,
ignoring all markup but including all the white space used for
indentation?

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


More information about the talk mailing list