OpenWGA 7.9 - OpenWGA Concepts and Features

Design and development » WebTML » Basic concepts

The document context

The document context connects the WebTML-based layout with the content data of the OpenWGA content store that should be published.

Every WebTML tag is executed in the context of a single content document. This means that WebTML functions that retrieve content data will retrieve it from that document in context, like for example <tml:item>.

For every WebTML page there is a main context which is the document that all WebTML tags have in context that do not choose other context documents explicitly. This document is normally chosen by a part in the URL that requested the current page, which addresses a content document by some key (see Publishing).

There are various functionalties in WebTML to change the context of WebTML tags in different ways. This is called context change.

The most direct way of doing a context change is the attribute context available on all WebTML tags. It may contain an expression syntax that chooses the document to retrieve. For example, this chooses the document of unique name "home" for context:

<tml:item context="name:home" name="body"/>

Context expressions may fetch documents relative to the context document from which they were called from. For example the expression "parent" selects the parent content of the current context document. A full reference of possible context expressions is documented at the context attribute.

The document context of a WebTML tag is inherited by other WebTML tags that are contained in its content. So you can change the context once to a special document via a WebTML tag - for example <tml:range> which merely acts like some range marker -  and then process various WebTML functionalties in this context by placing them inside this tag.

<tml:range context="name:home">


    ... tags here are automatically in context of the "home" document


</tml:range>

A context change may fail if there is no document with the criterias addressed in the context expression, for example if there is no document of name "home". In that case the current WebTML cancels its processing. Also any content of the tag is not processed. There is one exception of this rule: Condition tags which also use attribute iscontextvalid. They can be used to test availability of a context.

A special case is the so called dummy context. This is a virtual context that has no real content document assigned, simulating an empty document that cannot be modified or saved. It however "knows" the current application that is called so a context change will take the documents that are queried from that application.

The dummy context is used by WebTML in the following situations:

  • On so called contextless requests, when the URL of the page did not address a content document. It may just address a WebTML layout instead. In that case the main context of the page is a dummy context. WebTML tags on this contextless page nevertheless can fetch "real" contextes in the addressed application
  • After manually doing a context change into another application, by context path syntax "db:database-key". The dummy context then belongs to the addressed application and will fetch further contents from there.