Changes

Jump to navigation Jump to search
613 bytes added ,  09:18, 23 February 2011
The node element with @id=1 is copied and subsequently assigned a new QName using the rename expression. Note that the transform expression is the only expression which returns an actual XDM instance as a result. You can therefor use it to modify results and especially DOM nodes. This is an issue beginners are often confronted with. More on this topic can be found in the [[Update#Returning Results|XQUF Concepts]] section.
 
Below you find another example for a transform expression that hopefully clears things up a bit.
 
<pre class="brush:xquery">
copy $c :=
<entry>
<id>1</id>
<title>How to use a transform expression</title>
<updated>2011-02-23</updated>
<author>
<name>BaseX Team</name>
<uri>http://basex.org</uri>
</author>
<content type="html">Transform expression example created by BaseX Team</content>
</entry>
modify (
replace value of node $c//name with 'BaseX',
replace value of node $c//content with concat('Copy of: ', $c//content),
insert node <member>Joey</member> into $c//author
)
return $c
</pre>
===Functions===
administrator, Bureaucrats, editor, reviewer, Administrators
408

edits

Navigation menu