Template Developer Guide

If you want to develop templates, previous knowledge of the XSLT is required. The application basically takes the FeedMaster.xml file and transforms it using the XSL template provided. The template has full responsibility of processing the source data and generates desired output.

Transformation parameters

The content handler will supply the following XSLT parameters to the template (all are in default namespace):
  • MyUrl is the URL called by client, without any query string parameters, for example http://server/RssFrame/transform.plain.axd.
  • BaseUrl is the base URL of application, without last slash, ie. http://server/RssFrame.
These parameters can be used to build links to other templates, images, style sheets etc.

The handler will also forward values received using GET (query string) or POST (form fields). Name of the field is converted to lowercase and passed as parameter in one of the following namespaces:
  • GET (query string): http://schemas.altairis.cz/XML4web/Arguments#QueryString
  • POST (form fields): http://schemas.altairis.cz/XML4web/Arguments#FormFields
These parameters can be used for creating “smart” and user-customizable templates. You can see them in action in the Plain template, which can be supplied with two query string parameters, for number of items and URL of external CSS style sheet.

Format of FeedMaster.xml

Here you see sample of FeedMaster.xml file (with empty data elements for clarity):
<?xml version="1.0" encoding="utf-8"?>
<root>
    <group id="msdn" title="MSDN">
        <feed id="msdn01" title="Aktuálně" url="http://blogs.msdn.com/vyvojari/rss.xml">
            <last time="2008-09-11T10:12:32.0242042+02:00" status="OK" />
            <data />
        </feed>
        <feed id="msdn02" title="Akce" url="http://blogs.msdn.com/vyvojari/rss-akce.xml">
            <last time="2008-09-11T10:12:32.9460792+02:00" status="OK" />
            <data />
        </feed>
        <feed id="msdn03" title="Webcasty" url="http://www.microsoft.com/cze/msdn/rss-webcasts.xml">
            <last time="2008-09-11T10:12:33.2429542+02:00" status="OK" />
            <data />
        </feed>
    </group>
    <group id="tech" title="TechNet">
        <feed id="tech01" title="Aktuálně" url="http://blogs.technet.com/technetczsk/rss.xml">
            <last time="2008-09-11T10:12:33.6804542+02:00" status="OK" />
            <data />
        </feed>
        <feed id="tech02" title="Akce" url="http://www.microsoft.com/cze/events/rss_itpro.aspx">
            <last time="2008-09-11T10:12:34.9148292+02:00" status="OK" />
            <data />
        </feed>
        <feed id="tech03" title="Webcasty" url="http://www.microsoft.com/cze/technet/rss.aspx">
            <last time="2008-09-11T10:12:38.1960792+02:00" status="OK" />
            <data />
        </feed>
    </group>
</root>

The root element

This element does not have any attributes and serves as a document element. May contain one or more of group elements.

The group element

This element represents group of RSS feeds. Group is a logical construct you can use in the templates. Must contain the following attributes:
  • id – document-wide unique identifier
  • title – human readable friendly name of the group
May contain one or more of feed elements.

The feed element

This element represents single RSS feed. Must contain the following attributes:
  • id – document-wide unique identifier
  • title – human readable friendly name of the feed
  • url – address of the feed document
This element contains the last and data sub-elements.

The last element

This element contains information about the last update and its result.
  • time – time of the last try in XML format with time zone
  • status – result of the last try. If the operation was successful, it contains "OK". Otherwise it contains human-readable description of the error.
This element does not contain any sub-elements.

The data element

This element contains the actual content of RSS feed’s /rss/channel element. It does not contain any attributes and its internal structure is determined by the feed data downloaded.

Last edited Sep 28, 2008 at 5:47 PM by altair, version 2

Comments

No comments yet.