A data view can have arguments.
Arguments with a default value are optionals and can be ignored by the user.
Other arguments are required and they must be set whenever the data view is invoked.
User is allowed to pass undeclared arguments, but of course such arguments
will be used only if this is supported by the data view.
Undeclared and declared arguments are both accessible through the XPath function arguments().
It is up to the user to choose how to transmit the arguments values.
However, each argument must be set only once by request.
For example, if the data view declares arguments "arg1" and "arg2", then these arguments
can be set by one of the following syntax or any combination of them:
- Path of the URL (if allowed by the data view, see @path-format below):
- Any path e.g. XPath or path to a file
- REST-like with explicit name: http://host:8080/lavoisier/myview/arg1/value1/arg2/value2
- REST-like with implicit name: http://host:8080/lavoisier/myview/value1/value2
- Query field of the URL: http://host:8080/lavoisier/myview?arg1=value1&arg2=value2
- Data stream sent with a POST HTTP request: http://host:8080/lavoisier/myview
Argument elements support the following attributes:
- @name: The name of the argument. This is the only required attribute.
The value of declared arguments can be accessed with their name, prefixed by character "$".
It can also be accessed with: arguments()[@key='my-arg']
- @pattern: A regular expression pattern that can be used to restrict possible values for an argument.
The default pattern is "[^/]*".
- @path-format: This attributes defines the syntax for setting an argument from the path of the URL.
Supported options are:
- none: this option disables setting argument value in the path of the URL
- value (default): this option enables setting value in the path, with implicit argument name
- name_value: this option enables setting value in the path, with explicit argument name
- @eval/text(): The default value of the argument.
If @eval or text() is set, then the argument is optional, else it is required.
The text() node contains a static value, while the attribute @eval contains a XPath
that is dynamically evaluated when view is invoked.
This XPath can use value of other arguments, even if these arguments are set by the user.