OpenWGA 7.7 - WebTML reference

WebTML tags » item

<tml:item xpath ="xpath-expression">

Purpose:

Executes the given XPath expression on the item value. The <tml:item> tag will display the result of the XPath expression. The item value must contain valid XML data.

Description:

The attribute "xpath" can be used for content items and variables which contain XML data in the following form:

  • unparsed XML text
  • XML-DOM-Nodes, parsed by parseXML()
  • JavaScript XML object
The given XPath expression is executed on the XML data. The <tml:item> tag will display the corresponding result. If the XPath expression has multiple results a list will be returned. If the result is a XML subtree an XML object of the same type as the input type will be returned.

Further XPath expressions can be executed on item values or variables which contain a JavaBean. In this case the XPath expression will be evaluated on the bean properties.

Value(s):

Any XPath expression

Examples:

The item "bookmark" contains the following XML code:

<bookmark>
<title>OpenWGA</title>
<key type="uniquename">home</key>
<url>http://www.openwga.com</url>
</bookmark>

If you want to display the "title" only you can use:

<tml:item name="bookmark" xpath="bookmark/title"/>


To display the value of the attribute 'type' of the tag 'key':

<tml:item name="bookmark" xpath="bookmark/key/@type"/>