[xquery-talk] Defining a string array and setting values

Michael Kay mike at saxonica.com
Fri Jan 4 11:11:06 PST 2008


It looks to me as if you are guessing, and if you're assuming that XQuery
will behave like procedural languages that you may have encountered in the
past. That's not a good way to approach a new language: you will only find
yourself frustrated if you try to learn by trial and error.
 
Firstly, take the time to study the XQuery data model. You will find that it
doesn't have arrays, it has sequences.
 
Also, XQuery is a declarative language, so you can't update variables.
 
The way you initialize a global variable to a sequence of strings is
 
declare variable $e as xs:string* := {$x, $y, $z, $u};
 
Michael Kay
http://www.saxonica.com/


  _____  

From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Jayalakshmy K
Sent: 04 January 2008 04:28
To: talk at x-query.com
Subject: [xquery-talk] Defining a string array and setting values



I want to declare a string array and set values to it in a function 

how do i do it using XQuery. Itried using this but it didn't work 
declare variable $errorParam:= ""; 
        $errorParam[.= 0] = $x 
        $errorParam[.= 1] = $y 
        $errorParam[.= 2] = $z 
        $errorParam[.= 3] = $w 
        $errorParam[.= 4] = $u 



______________________________________________________________________


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20080104/5601412c/attachment.htm


More information about the talk mailing list