[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

problem with loops

Titash Neogi titash_neogi at symantec.com
Wed Jan 4 00:39:29 PST 2006


let request request parameter
Hello All,

Happy New year!

My question is related to a programming problem that I am unable to
solve. Please refer to the code listed below

______________________________

declare function lcl:caller()
{

       let $QV1 := request:request-parameter("val1","")

       let $count:= 0

       let $QV1:= lcl:tracer($QV1)


       let $k:= lcl:rend($QV1)

       let $QV2:= $QV1/result/text()

       let $QV1:= lcl:tracer($k)


       let $k:= lcl:rend($QV1)

       let $QV3:= $QV1/result/text()

       let $QV1:= lcl:tracer($k)



       let $k:= lcl:rend($QV1)

       let $QV4:= $QV1/result/text()

       let $QV1:= lcl:tracer($k)

let $final:= concat($QV2," ",$QV3," ",$QV4)

return $final
};

____________________________

What I am trying to do here is calling two local functions (tracer and
rend) 3 times and storing the result in three variables QV2, QV3 and
QV4.

Now my problem starts when  I remove those three iterations and try to
implement a for loop that traverses through a xml document and stores
all the results in a single variable.

Something as shown below
____________________________________


declare function lcl:caller()
{

       let $QV1 := request:request-parameter("val1","")

       let $count:= 0

       let $QV1:= lcl:tracer($QV1)

for $d in /maps/map

       let $k:= lcl:rend($QV1)

       let $QV2:= $QV1

       let $QV1:= lcl:tracer($k)


       return $QV2




};
________________________________________

This doesnt work because all I get is the values returned by the
functions the first time, repeated n number of times.

I have tried to implement something like an array ( $QV[$index]:= $QV1
)  but that gives me a syntax error.

How do I implement this? Any ideas suggestions will be most helpful.

Thanks and Regards
Titash Neogi



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.