Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This format applies same template for every matched element by ItemXPath.

Code Block
languagexml
titleScripting Usage
{{ SAMPLE REPORT
   <h1>{{Customer/Name}}</h1>
   <table>
   {{ Rows/Row => 
     <tr><td>{{Date}}</td><td>{{Description}}</td></tr> }}
   </table> }}

Generates the following output:

Code Block
languagexml
SAMPLE REPORT
<h1>John</h1>
<table>
  <tr><td>2010-01-01</td><td>description</td></tr>
  <tr><td>2015-01-01</td><td>other description</td></tr>
</table>

...

While generating HTML content some tags ( like table tag ) may become corrupted if {{ x => y}} template is used. As an alternative method format function supports the x-repeat attribute to perform repeating content. 

Code Block
languagexml
{{ SAMPLE REPORT
   <table>
     <tr x-repeat="Rows/Row">
       <td>{{Date}}</td><td>{{Description}}</td>
     </tr>
   </table> }}

...

For each item at specified in ItemXPath sub template is generated and also same template is repeated again for Template content recursively.

Code Block
languagexml
{{ <h1>SAMPLE REPORT</h1>
   {{ Sections/Section =>> 
      <h2>{{Name}}</h2>
      <p>{{Body}}</p>  }}

}}

result:

Code Block
languagexml
<h1>SAMPLE REPORT</h1>
<h2>My Section</h2>
<p>Section content</p>
<h2>Sub Section</h2>
<p>Child section content</p>