OpenWGA 7.10 - TMLScript reference

TMLContext "this"
Method :

tag([tagid])

On object TMLContext "this"
Usage Retrieves a WebTML tag information object
Description

This method is the TMLScript pendant of <tml:metadata type="taginfo"/> and is used to retrieve information fields from WebTML tags, called "tag infos".

tag() returns a TagInfo object and you can access the actual info values via properties:

tag("tagid").count

The tagInfo objects represents the addressed TMLTag. Typically you will retrieve a tag by id. Without an id parameter the current tag is addressed - typically the <tml:script> tag containing the code.

The TagInfo object has a method parent([tagname]) to address the direct parent tag or any parent tag in the hierarchy with the given tagname.

tag().parent("include")

Will address the next <tml:include> tag in the parent hierarchy.

Parameters tagid (String) opitonal:

ID of the tag to retrieve tag information from. If no tagid is given the current tag is addressed (typically the current <tml:script> tag).


Return value A tag information object.
Allowed in script types
  • WebTML pages and normal WebTML actions
Examples

<tml:collection>

    <tml:query>...</tml:query>

    <tml:foreach>...</tml:foreach>

    Documents found: <tml:script expression="tag().parent('collection').count"/>

</tml:collection>

Will output the number of results without using an "id" attribute.