Show TOC

Preprocessing InstructionsLocate this document in the navigation structure

You can use an XML view as a template that is transformed by an XML preprocessor on the source level, that is, the XML DOM, before an SAPUI5 control tree is created from that XML source.

See the example and introduction in the topic XML Templating in SAPUI5.

In the example, the models available to the preprocessor are initially as follows. Note how a model name can be seen as a variable with a value that consists of two pieces: a model instance and a binding context's path.

meta = oMetaModel, "/dataServices/schema/0/entityType/0"

You can base conditions on the available variables. XML attributes that represent an available binding are replaced automatically. The <template:with> instruction can be used to change a variable's value or to add a variable with a new name. Likewise, the <template:repeat> instruction deals with its loop variable. When a fragment is inlined, the current variable assignment is propagated into the fragment's content and so on. Preprocessing instructions are inserted in XML syntax and assigned to the XML namespace http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1, which is referred to by the namespace prefix template in the code samples.