Re: XQuery function

Jonathan Robie wrote:
> 
> At 02:55 PM 7/6/2001 -0300, Claudio Hessel Peixoto Gomes wrote:
> >I declared the function:
> >
> >define function tInterval($param) returns result
> >{
> >    for $var1 in document("tvm-4.xml")//TemporalObjects/Object
> >    return
> >       <result <mailto:oid={$var1/@oid>oid={$var1/@oid}>
> >       {
> >          for $var2 in concat("$var1//Attributes/",$param,"/Value")
> >          return
> >             <tInterval
> > <mailto:tTimei={$var2/@tTimei>tTimei={$var2/@tTimei}
> > <mailto:tTimef={$var2/@tTimef}/>tTimef={$var2/@tTimef}/>
> >       }
> >       </result>
> >}
> >
> >And call:
> >tInterval(CONCAT_ELEMENT)
> >
> >I want concat a child in expression, like this:
> >"//Attributes/CONCAT_ELEMENT/Value"
> >A function CONCAT can used for this?
> 
> The function library for XQuery has not yet been fixed. Since concat() is
> supported by XPath, it seems quite plausible that this will be one of the
> functions in the library when the library is established. For now, each
> implementation may have a different set of functions.

But even if an implementation provides concat(), it presumably just returns
a string, which isn't going to do the OP any good. That is, in the example,
$var2 will be bound to (something like) the string
"$var1//Attributes/CONCAT_ELEMENT/Value", whereas he apparently wants it
bound to each of the nodes that would result from evaluating that string as
XQuery/XPath.

-Michael Dyck

Received on Monday, 9 July 2001 22:51:07 UTC