Changes

Jump to navigation Jump to search
2 bytes removed ,  16:22, 21 August 2012
no edit summary
|}
==request:set-attribute==
{|
|-
| width='90' | '''Signatures'''
|{{Func|request:set-attribute|$request as basex:request, $key as xs:string, $value as |xs:string|empty-sequence()?}}
|-
| '''Summary'''
|Binds Returns the value of an attribute with the specified value bound to the current session, or an empty sequence if no value was bound.
|-
| '''Examples'''
|The following RESTXQ function can e.g. be called via <code><nowiki>http://localhost:8984/restxq/setget?key=user&value=john</nowiki></code>:
<pre class="brush:xquery">
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/setget")
%restxq:query-param("key", "{$key}", "")
%restxq:query-param("value", "{$value}", "")
%restxq:request("{$req}")
function test:setget($req, $key, $value)
{
'Value of ' || $key || ': ' || request:setget-attribute($req, $key, $value), 'Attribute was set.'
};
</pre>
|}
==request:getupdate-attribute==
{|
|-
| width='90' | '''Signatures'''
|{{Func|request:getupdate-attribute|$request as basex:request, $key as xs:string|, $value as xs:string?|empty-sequence()}}
|-
| '''Summary'''
|Returns Binds an attribute with the specified value of an attribute bound to the current session, or an empty sequence if no value was bound.
|-
| '''Examples'''
|The following RESTXQ function can e.g. be called via <code><nowiki>http://localhost:8984/restxq/getset?key=user&value=john</nowiki></code>:
<pre class="brush:xquery">
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/getset")
%restxq:query-param("key", "{$key}", "")
%restxq:query-param("value", "{$value}", "")
%restxq:request("{$req}")
function test:getset($req, $key, $value)
{
'Value of ' || $key || ': ' || request:getset-attribute($req, $key, $value), 'Attribute was set.'
};
</pre>
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu