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

xf:attribute

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

xf:element

Creates an XML element.


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

xf:else

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

xf:evaluate

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(
	contains(string-replace($mystring,'Old','New'),'Old')),'tru'),'u')"/>

xf:get

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/
			   3.0/context/org.bibop.xml.xforge.helpers.ThreadContext">

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

xf:if

Used to construct conditional expressions.


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

xf:include

Explanation here.

xf:node

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">
	<some>
		<xml>
			<element>data</element>
		</xml>
	</some>
</xf:node>

xf:number

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>

xf:parameter

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>

<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:process>

<xsl:apply>
	<xf:parameter name="xml">
		<person><lastname>Doe</lastname><firstname>John</firstname></person>
	</xf:parameter>
	<xf:parameter name="xsl">test/test.xsl</xf:parameter>
</xsl:apply>

xf:process

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

xf:set

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


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

xf:string

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


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

xf:while

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>
</xf:while>