Hi Dan,
Insert node attribute Z {'B'} into $c/title should do it.
I recommend [XQuery Update for the impatient] as second reference for XQuery Update facility.
cheers Arve
[XQuery Update for the impatient] http://www.xmlmind.com/tutorials/XQueryUpdate/index.html
On 12 Apr 2014, at 06:52, 積丹尼 Dan Jacobson jidanni@jidanni.org wrote:
http://docs.basex.org/wiki/XQuery_Update mentions insert attribute. So how can I insert attribute?
$ cat x.xq copy $c :=
<entry> <title>Transform expression example</title> <author>BaseX Team</author> </entry> modify ( replace value of node $c/author with 'BaseX', replace value of node $c/title with concat('Copy of: ', $c/title), insert node <author>Joey</author> into $c, insert attribute Z {'B'} into $c/title, ) return $c $ basex x.xq Stopped at /tmp/x.xq, 10/10: [XPST0003] Expecting ')', found 'a'.
$ apt-cache policy basex basex: Installed: 7.8.2-1 Candidate: 7.8.2-1 Version table: *** 7.8.2-1 0 500 http://ftp.br.debian.org/debian/ unstable/main i386 Packages 100 /var/lib/dpkg/status