RSS feeds serve as an excellent mechanism to exchange data in a form readable by
machines. But, they fall short at the last step where a person is the final consumer.
There are solutions such as feature rich feed readers, XSLT transform, CSS, etc.
which are great tools that partly address this problem.
But what we offer is something more broad: the ability to transform feed data into
a variety of formats such as Word document,
Excel spreadsheet, HTML page, or a source
code file (we actually do this internally), or other custom formats.
This is the need fulfilled by RSBTemplates. RSBTemplates are used in RSBPanel, RSSBus Office
Add-In, and the RSSBus Feed Server. In RSSBus Feed Server templates are scripts
with the .rst extension.
When RSSBus Engine encounters anything other than an RSBScript keyword (for example,
an HTML tag), it treats it as an output for template content generation (instead
of trying to interpret it as part of the script). This is not usually used in feeds
(.rsb files), but it is a cornerstone of the RSBScript template model.
For a quick and easy example, let's use the operation fileListDir. To make
this template, copy the script below to a file FileListDir.rst within your webroot
and browse to it to see the results.
<rsb:set item="input" attr="mask" value="[mask | def('*')]" />
<rsb:set item="input" attr="path" value="[path | def('.')]" />
<table width="100%">
<tr align="left"><th>Name</th><th>Size</th><th>Modified</th></tr>
<rsb:call op="fileListDir" in="input" out="output">
<tr>
<td>[file:name]</td>
<td>[file:size]</td>
<td>[file:mtime]</td>
</tr>
</rsb:call>
</table>
Notice how the code snippet contains several HTML tags. RSBScript will not interpret
those as part of the script, but instead will output them verbatim as part of the
template output. This can be very useful when generating alternate content and/or
user interface elements with RSSBus.
Consider the elements that are within square brackets (e.g. [file:name]). The elements
within brackets are evaluated by RSBScript and are used to extract data from item
attributes. For example, [file:name] is replaced at runtime by the value of the
“file:name” attribute of the current output item produced by the
<rsb:call> keyword. You can also explicitly reference
an item and even introduce formatters to manipulate the data as it is evaluated
(for example, to convert all characters to upper case, you would write [file:name
| toupper]).