Re: XQuery function

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 oid={$var1/@oid}>
>       {
>          for $var2 in concat("$var1//Attributes/",$param,"/Value")
>          return
>             <tInterval tTimei={$var2/@tTimei} 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?
> Other function can?

I think the proper way to do this would be to replace
    concat("$var1//Attributes/",$param,"/Value")
with
    $var1//Attributes/*[name()=$param]/Value

-Michael Dyck

Received on Saturday, 7 July 2001 00:05:23 UTC