Thanks. but how to custom update response type is application/xml ? -- 此致 easy 莫愁前路无知己,天下谁人不识君。 在 2013-12-11 15:18:14,"Wiemer, Sebastian" <Sebastian.Wiemer@adesso.de> 写道: Am 11.12.2013 um 07:04 schrieb easy <lin_xd@126.com>: hi,all, hi 此致, 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 $x is declared here for $x in doc($test)//header[id=12001] return db:output('ok,path='||$path) here ends the statement: db:output(…) is what you return, where $x is in scope , insert node ( 'text', <e>test</e> ) into $x here $x is out of scope, because the comma separates the statements and this is simply an other statement. You can use parenthesis to put both statements in one sequence: ( db:output('ok,path='||$path) ,insert node ( 'text', <e>test</e> ) into $x ) You will then return a sequence with two items instead of returning „db:output(…)“ x-times and afterwards perform „insert node (…) into $x“ one time (where $x is out of scope) This might clarify things further: for $i in 1 to 10 return $i,“I am the second statement and will executed only once, not ten times" }; -- 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? Yes: insert node ( 'text', <e>test</e> ) into $x ,db:output('ok,path='||$path) If $path should be out of scope, the same solution as mentioned above applies. many Thanks. hope this helped, Sebastian 此致 easy 莫愁前路无知己,天下谁人不识君。 _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk