Templates

<< Click to Display Table of Contents >>

Navigation:  Delphi HTML Report Library >

Templates

HRL uses Mustache template syntax. Context variables are set as XML objects, where attributes are treated as variables and nodes as sections

For example, passing a object

<animals>
 <animal name="Dog" color="yellow"/>
 <animal name="Bird" color="green"/>
</animals>

 

To the template

<html>
{{#animals}}
 <p style="color: {{color}}">{{name}}</p>
{{/animals}}
</html>

 

results

dog

bird

Document-level templates are processed after special tags, so data generated during tags processing (for example, from the database using DATAPACKET tag)  could be used anywhere in the report.