OpenWGA 7.6 - WebTML reference

WebTML tags » [All tags]

<tml:[All tags] context ="context-expression">


Changes the document context of the current tag


If a WebTML tag has a context attribute it first tries to change the context as specified before executing any other functionalities. If the context change fails - either if there is no document on the addressed position or if the context expression is syntactically wrong - then the WebTML tag normally cancels execution. This includes all eventually contained WebTML tags.

An exception to this rule are condition tags that have an attribute iscontextvalid, which is able to react properly on context change success and failure. Such a tag that is executed "because of" a context change failure runs under the original context:
<tml:case context="any-context-expression" iscontextvalid="false">
<!-- Contents of this tag is executed explicitly on a failing context change-->

The - eventually changed - WebTML context of a tag is inherited by all tags that are contained in its body. If you do not want this you might consider using privatecontext instead.

On each context change the language of the target document is again determined, based on the users preferred languages and the available languages. The target language does not have to be of the same as the document where the context change starts from.


Simple context expressions

children[idx] - A child document with the given absolute index. Index 0 is the first child document in the children list.

createddoc - A document created before in the current request from a WebTML form of source type "newcontent"

main | currentdocument - The main document of the request, i.e. the one that was addressed via UR.

module - The original context of the current WebTML module

parent - The parent document of the current context document

portlet - The portlet context of the current WebTML portlet

root - The root document of the current context document

selectedchild - The child document which is "selected", i.e. it is an ancestor of the current main document. See attribute isselected.

siblings[idx] - A sibling document with the given absolute index. 0 is the first sibling document in the siblings list.

siblings[+/-idx] - A sibling document with the given index, relative to the current document. So +1 is the next sibling, -1 is the previous sibling in the siblings list.

this - The current context document. Combine this with language change expressions to get special language versions of the current document.

vlinktarget - The target document of the virtual link of the current content. Only works on virtual links that really address the content itself.

Expressions with parameters

area:areaname - The first root document of the given web area.

contentclass:contentclass The first content up the hierarchy with the given content class, starting with the current context

contenttype:contenttype The first content up the hierarchy with the given content type, starting with the current context

contentid:<contentid> For use with HDBModel apps. Navigates to the content document with the given content-id below a storage document currently in context

db:dbkey - Changes to the given database, without positioning on any explicit content document. Use in a concatenated expression paths to first choose the database. Choose the concrete document in that database in the next expression.

docid: document-id - A content document with the given document id. All IDs that are also suitable to address the document in a URL may be used. This may for example be a content key, struct/page key or an unique name.

level: levelnr - Goes up the parent hierarchy and stops at the page with the given parameter level. Top level documents have level 1, their children have 2 and so on.

name:unique-name - A content document of the given unique name.

np: unique-name-part - A document whose unique name equals the one of the current document plus the given unique name part, divided by a dot ".". So on a document with unique name "customers.ig" changing context via expression "np:networkinfrastructure" would navigate to a document of name "customers.ig.networkinfrastructure". If the current document has no unique name it just searches the given name part as complete unique name. Some OpenWGA functionalities (f.e. HDBModel) and applications (f.e. Wiki) automatically create unique names of this style where child documents inherit the name of their parents plus specific name part additions.

plugin:plugin-name - Changes to the database of the plugin of the given unique name without positioning on any explicit document. Otherwise the same behaviour and usage as on "db:dbkey".

query:query-id - The first document of a query result. Specify the ID of the <tml:query> tag from which to take the result.

relation: relation-name - The content document addressed by the given relation on the current content document

role:rolle - Use in concatenated path expressions to change the "navigation role" of the current functionality, like attribute "role" navigators or queries. Use "nav", "search", "sitemap" or "none" to influence the behaviour of subsequent context expressions. For example: "nav/children[0]" to choose the first child document which is visible for navigators.

storageid:<storageid> For use with HDBModel apps. Navigates to a storage document with the given storage-id, either directly below a content document in context or up the hierarchy from the current context.

tag: tagid - Takes over the context of another tag, specified by its ID.

Explicit language change on single expressions

expr<language> - Determines an explicit target language for an expression. The context change fails if there is no document of the given language on the location addressed by the expression.

expr<> - Determines the database default language as target language of an expression. The context change fails if there is no document of the default language on the location addressed by the expression.

Concatenating expressions to expression paths

expr/expr/expr... - A path of single context expressions, processed from left to right. Use any simple or parametrized expressions documented here as single "expr" expressions. Separate them by slashes. Each expression starts from the context that was calculated by the previous expression. The final context that will be used by the WebTML tag is the one calculated by the last expression.

If a single expression in a path fails then the complete context change is aborted and the tag canceled.


Some examples returning the title of various documents using tag <tml:meta>.

Choosing the root document of the current document and returning its title:
<tml:meta name="title" context="root">

Returning the title of the first child document, using "children[idx]":
<tml:meta name="title" context="children[0]">

Returning the title of the document with unique name "home":
<tml:meta name="title" context="name:home">

The following example executes a query. The following <tml:item> tag uses the "query:" expression to select the first result of the query and return an item "phone" from it:
<tml:query id="names" db="names" type="formula">fullname="bill gates</tml:query>

<tml:item name="phone" context="query:names"/>

A concatenated path expression. It first changes to database "names", then retrieves the document with unique name "home" from there:
<tml:range db="names" context="db:names/name:home">
    <tml:item name="fullname"/>