Difference between revisions of "XQuery Recipes"
Jump to navigation
Jump to search
(→Computed Elements: Added return value of the example) |
|||
| Line 8: | Line 8: | ||
attribute { "about" } {$class}, $contents | attribute { "about" } {$class}, $contents | ||
} | } | ||
| + | </pre> | ||
| + | The result is an element named "Element1": | ||
| + | <pre class="brush:xml"> | ||
| + | <Element1 about="hi"> | ||
| + | <foo> | ||
| + | <br/>Bar!</foo> | ||
| + | </Element1> | ||
</pre> | </pre> | ||
[[Category:XQuery]] | [[Category:XQuery]] | ||
[[Category:Finish]] | [[Category:Finish]] | ||
Revision as of 10:56, 12 January 2011
This page contains code snippets that mainly originate from our Mailing List.
Computed Elements
Returns dynamically named elements:
let $name:= "Element1"
let $class := "hi"
let $contents :=<foo><br />Bar!</foo>
return element {$name} {
attribute { "about" } {$class}, $contents
}
The result is an element named "Element1":
<Element1 about="hi">
<foo>
<br/>Bar!</foo>
</Element1>