XQuery Recipes
Jump to navigation
Jump to search
This page contains code snippets that mainly originate from our basex-talk mailing list.
Computed Elements
Returns dynamically named elements:
let $root := "element"
let $value := "hi"
let $contents := <foo>Bar!</foo>
return element { $root } {
attribute { "about" } { $value }, $contents
}
The result is an XML fragment with <element> as root node:
<element about="hi"> <foo>Bar!</foo> </element>