X:Forge Tag Reference

Alphabetical Listing

The following tags are available in X:Forge:

  • xf:attribute
  • xf:element
  • xf:else
  • xf:evaluate
  • xf:get
  • xf:if
  • xf:include
  • xf:node
  • xf:number
  • xf:parameter
  • xf:process
  • xf:set
  • xf:string
  • xf:while


Creates an attribute for an XML element. For an example see xf:element.


Creates an XML element.

<xf:element name="testelement">
	<xf:attribute name="testattribute">testvalue</xf:attribute>


Used with xf:if, for an explanation see there.


Evaluates an expression. X:Forge contains a simple expressions parser. In the following usage examples it is assumed that a variable of the correct type has been declared before. For example, the string-length function obviously expects a string and the xpath function a node, so these should be declared via xf:string or xf:node before using them in an expression.

<xf:evaluate expression="'The string length is: ' + string-length($mystring)"/>

<xf:evaluate expression="$mynode#xpath('/some/xml/element')"/>

<xf:evaluate expression="$myint * 2 + $myotherint"/>

<xf:evaluate expression="$myint &lt; 10"/>

<xf:evaluate expression="indexof(starts-with(not(


Get the current value of a previously declared variable. It is also possible to retrieve a serialized object from a context, if the object has been put into the context before.

<xf:get name="myvar"/>

<contextdemo xmlns:thread="http://xforge.org/xforge/

	A serialized object from the thread context: <xf:get name="thread:testfile"/>


Used to construct conditional expressions.

<xf:if test="$mystring=trim('Some other value...')">
	Test successful.
	Test not successful.


Explanation here.


Declares a node variable, which can later be retrieved with xf:get or evaluated with the xpath function (see xf:evaluate).

<xf:node name="mynode">


Declares a number-type variable, which can later be retrieved with xf:get. There are several types of numbers available, the default (if there is no type attribute) is double.

<xf:number type="bool" name="mybool">true</xf:number>

<xf:number type="byte" name="mybyte">3</xf:number>

<xf:number type="int" name="myint">525</xf:number>

<xf:number type="double" name="mydouble">11111111111111111111</xf:number>


Whenever a component is invoked via xf:process, the X:Forge Reflection Mapper or a mapped namespace prefix, the xf:parameter tag can be used to pass parameters to the component. Here are examples for these invocation mechanisms:

<xf:process using="FormattedDate">
	<xf:parameter name="format">yyyy.MM.dd G ' at' hh:mm:ss z</xf:parameter>

<xf:process using="MyBean">
	<xf:parameter name="setLastName">Doe</xf:parameter>
	<xf:parameter name="setFirstName">John</xf:parameter>
	<xf:parameter name="getLastName"/>
	<xf:parameter name="getFirstName"/>

	<xf:parameter name="xml">
	<xf:parameter name="xsl">test/test.xsl</xf:parameter>


One of the invocation mechanisms for X:Forge components. A detailed explanation can be found on the index page.


Used to set a variable's value after it has been declared.

<xf:set name="mystring">Some value...</xf:set>


Declares a string variable, which can later be retrieved with xf:get.

<xf:string name="mystring">mystringvalue</xf:string>


With this tag it is possible to construct loops:

<xf:while test="$i &lt; $count">
	<xf:set name="result"><xf:evaluate expression="$result+$i"/></xf:set>
	<xf:set name="i"><xf:evaluate expression="$i+1"/></xf:set>