request:getParameter

Purpose

Used to access the value of a request parameter.

If the specified request parameter exists then its value is returned. If it does not exist, the result depends on whether a default argument was provided. If it was then it is returned as the result of this function, otherwise an empty sequence is returned.

A request parameter can have more than one value associated with it, for example by repeating the parameter. If this is the case then this function will be equivalent to accessing the first value returned by calling the request:getParameters function.

Signature

request:getParameter [name, default] as xs:string?

Parameter

Name Description Type Use
name Tthe name of the request parameter xs:string required 
default The value to return if the request parameter is not present xs:string optional 

Examples

Request the following XDIME page using the URL following example.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline">
  <head>
    <title>request:getParameter</title>
  </head>
  <body>
    <p>Parameter: <pipeline:value-of expr="request:getParameter('par')"/></p>
  </body>
</html>
http://localhost:8080/mcs/test/test.xdime?par=aaa&par=bbb

Related topics