Output

All flow-functions produce a result. The output element informs the flow-function as to which spaces the result should be placed. A flow-function may have multiple output declarations, and each one will receive it's own copy of the flow-function result.

It is important to remember that the default output (ie, if no output is declared) is space="immediate", which passes the result to the parent (or to stdout when the flow-function is the root element). Therefore, when results are to be discarded, an output of space="none" must be declared.

space attribute

  • immediate* outputs to parent or stdout
  • store outputs to a store (variable)
  • file outputs to a file on the filesystem
  • cookie outputs to a response-cookie if Obyx is being run as a cgi, otherwise it is ignored. The part of a cookie to be written to can be chosen by using the part attribute.
  • error This is the throw exception mechanism of Obyx - the result will be the text of the throw.
  • http outputs to http response headers if Obyx is being run as a cgi, otherwise it is ignored.
  • none the result is discarded
  • namespace the result is to be used as a namespace signifier
  • grammar the result is to be used as an xml grammar (either DTD or XML Schema are supported)

The following example shows an example of placing a result into a store. This store is then tested against the same data, and where you can see that it exists and is the same as the store.

<instruction>
	<output space="store" value="number" />
	<input value="1234321" />
</instruction>
<comparison operation="equal">
	<comparate space="store" value="number" />
	<comparate value="1234321" />
	<ontrue value="This number exists" />
	<onfalse value="This number doesn't exist" />
</comparison>
This number exists

part attribute

This is only used when the space attribute is a cookie. There are four values: ('value', 'expires', 'domain', 'path') which refer to the different parts of a response cookie. By default it is the value of the cookie which is set. As well as the standard date format, the expires value recognises two helper settings: "persist" and "discard". Persist will set expiry one year hence, and discard will set expiry into the past, effectively asking the user-agent to delete the cookie.

<instruction>
	<output space="cookie" part="value" value="foo" />
	<input value="hello" />
</instruction>
Set-Cookie:foo=hello; path=/


Last Modified: Tue, 08 Jun 2010