[xquery-talk] step expression

Jonathan Robie jonathan.robie at datadirect.com
Mon Apr 17 14:24:08 PDT 2006

Tim Finney wrote:
> This kind of expression is allowed:
> doc($doc_name)/node_seq_1/node_seq_2
> I would like to be able to do this:
> let
>   $step1 := some_fn($name_space1, $element_name_1)
>   $step2 := some_fn($name_space2, $element_name_2)
> return
>   doc($doc_name)/$step1/$step2
> Can this be done?

Hi Tim,

You do this using the name() function:

let $doc_name := "invoice.xml"
let $step1 := "invoice"
let $step2 := "customer"
 doc($doc_name)/*[name() eq $step1]/*[name() eq $step2]

Hope this helps!


Read my Blog: http://blogs.datadirect.com/jonathan_robie/
Learn XQuery: http://media.datadirect.com/download/docs/ddxquery/tutorial_query.html
Learn XQJ (the JDBC for XQuery): http://www.datadirect.com/developer/xquery/topics/xqj_tutorial/
Get DataDirect XQuery: http://www.datadirect.com/products/xquery/

More information about the talk mailing list