Kauri Documentation
 PreviousHomeNext 
8.3.3 Using templating in standalone JavaBook Index8.4.2 Expression language

8.4 Syntax reference

8.4.1 Basic rules

8.4.1.1 Templates are valid XML files

The Kauri template language is XML-based.

A template file must be a well-formed XML file. So you cannot do things like:

<html>
   <body ${some expr}="value">

   <t:if test="${some expr}">
     </body>
   </t:if>
</html>

The errors in the above snippet are that you can't create dynamic variable names this way, and that the body and t:if elements are not properly nested.

8.4.1.2 Namespace for template instructions

A simple template might contain just some ${...} expressions, but as soon as you want to use any instructions, you will need to declare the Kauri template namespace, which is:

http://kauriproject.org/template

Here's an example of how to bind the namespace to the "t" prefix and use instructions:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:t="http://kauriproject.org/template">
  <t:forEach begin="1" end="5" step="2">
    <p>do something</p>
  </t:forEach>
</root>
 PreviousHomeNext 
8.3.3 Using templating in standalone Java8.4.2 Expression language