- From: Jason Hunter <jhunter@acm.org>
- Date: Thu, 22 Jul 2004 18:22:43 -0700
- To: Michael Kay <mhk@mhk.me.uk>
- Cc: 'Stéphane Mbaye' <stephane.mbaye@gael.fr>, "'XQuery'" <www-ql@w3.org>
The function is xdmp:eval() in the Mark Logic engine. "xdmp" is one of the namespaces used for server-specific functions. Like Michael says, there's no standard eval function but it's hard to do some things without it. (It's nice having the Mark Logic engine freely available now because I can answer questions like this. If you want to experiment with the ML engine, it's http://xqzone.marklogic.com.) -jh- Michael Kay wrote: > There is no standard function to do this. > > A number of XSLT processors (Saxon was the first) have provided an > evaluate() function to fill this gap - there is a semi-standardized > specification at www.exslt.org <http://www.exslt.org>. Unfortunately > Saxon's version, saxon:evaluate() is not currently available via the > XQuery interface, only via XSLT. I don't think there's a good technical > reason for this restriction, it's mainly a question of testing. > > One or two of us did push quite hard for a standard evaluate() function, > but the WG decided against. The main arguments, if I recall, were (a) > that it broke type safety, (b) that some processors use a compilation > architecture in which the parser isn't available at run-time, and (c) > that it's not obvious how much of the static/dynamic context should be > available to the evaluated expression. > > (At least you understand what it is that you're asking for! A lot of > XSLT users have stumbled into this without knowing what they are doing, > they try to write things like a[$x] where $x is the string "@foo='bar'" > I think the problem is that the use of $ to introduce variables is > associated in some people's minds with macro languages). > > Michael Kay > > ------------------------------------------------------------------------ > *From:* www-ql-request@w3.org [mailto:www-ql-request@w3.org] *On > Behalf Of *Stéphane Mbaye > *Sent:* 22 July 2004 23:48 > *To:* XQuery > *Subject:* Evaluation function > > Dear all, > > > > how to evaluate a string as an Expr or ExprSignle expression from > the body of a query script ? As en example is may be useful in the > following script: > > > > declare variable $query as xs:string external; > > fn:evaluate($query) > > > > Thank you in advance. > > Stephane Mbaye > > > > GAEL Consultant >
Received on Thursday, 22 July 2004 21:22:58 UTC