hi,all, 
I have write a restxq service, as following:
-------------------------------
module namespace page = 'http://basex.orgs/examples/web-page';
declare
  %output:method("xhtml")
  %output:omit-xml-declaration("no")
  %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN")
  %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd")
  %updating
  %rest:path("/addehr")
  %rest:POST('{$ehr}')
  %rest:GET 
  %rest:form-param("message","{$message}", "(no message)")
  %rest:header-param("User-Agent", "{$agent}")
  function  page:hello-postman(
    $ehr,
    $message as xs:string,
    $agent   as xs:string*)
 {
 let $path:=substring('5102108843434',1,3)||'/'||'test'
 let $test := 'ehr/v1/1382968159350/12001.xml'
return 
for $x in  doc($test)//header[id=12001]
return
 db:output('ok,path='||$path), insert node (  'text', <e>test</e> ) into $x
};
 
--
but still say :undefined variavle $x. 
how to do ? is there a good way to do insert update operation on a file and return some customzied response?
many Thanks.
此致

   easy

莫愁前路无知己,天下谁人不识君。