0.3 Jelly <tag>set</tag> and <tag>out</tag> Examples
Introduction In Jelly a lot of possible. The functionality used most by the user is the use of variables. It is possible to use variables as text, where XML is not interpreted, but it is also possible to interpret the XML and even to select only a part of the XML with an XPath expression. More information about Jelly can be found in . Note that the Jelly expression $${..} will be executed even from a CDATA tag or a <!-- --> comment section. The way to escape it is to use an extra dollar as in $$$${..}. Some variables are automatically set and allow access to various information. It is possible to overwrite these locally, but this is not recommended. The variables are: $formdata For a submitted form this consists of a tag variables, containing the submitted form data. $instance This contains internal information and should not be needed. First an example will be given with text and then another with XML code. Note that the namespaces used are xmlns:c='jelly:core' and xmlns:x='jelly:xml'.
Some Examples An example with text set and read using <code>jelly:core</code>. 0.3 The version is or $${version}. ]]> This is an example where the text 0.3 is put in a variable named version. The trim attribute eith value true indicates that any whitespace at the beginning or the end should be removed. The result is displayed below:
The version is or ${version}.
An example with XML set and read using <code>jelly:xml</code>. 2 1 The formula is . The part of the formula right of the equals-sign is . ]]> This is an example where an Openmath function definition is put in a variable called formula. With x:copyOf it is possible to select the whole object or to select a part of it. The output is displayed below.
2 1 The formula is . The part of the formula right of the equals-sign is .
More information The main Jelly page is the Apache Jelly page. On that sit is also more about the jelly:core tags (c:-tags), more about the other tags (one of which is xml) and more about JEXL, the Java Expression Language.