OpenWGA 7.8 - WebTML reference

WebTML tags » foreach

<tml:foreach sortitem ="item | variable">


Sorts the iteration output by a content item


This is only valid with type="content".

Use this attribute together with sortorder. It specifies an item which should be available on the documents that are used by this tag. The output will be sorted by the natural sorting order of the items values.

Sorting can have very bad performance on large collections, even if only a small part of that collection is displayed. The reason for this is that OpenWGA needs to load all documents in the collection before it can sort them and determine what documents are in the requested page.

On collections from queries please consider using the query languages own ordering capabilities instead if possible.

On navigators please consider using attribute order instead if possible.


Itemname which is found in all results.


This example sorts the output by the values of the item "_customer_name" on the put out documents:


    <tml:query> ... </tml:query>
    <tml:foreach sortorder="ascending" sortitem="_customer_name">
    <li><tml:item name="_customer_name"/></li>