Knowledgebase

Article number: 301418

XML Source page (XML Source as a Content Type)

Sitekit CMS (Content Management System) allows a great deal of technical flexibility through a generic XML consumer.

The Sitekit CMS XML consumer can either be used via an XML Source page; an XML Data Island; or the Custom data module.

The benefits include:

  • Front-end & backend extensibility
  • Interoperability
  • Syndication
  • Standards compliance (for example eGIF compliance)

 


Notes. this article assumes a general knowledge of XML and XLST. If you are not yet familiar with these then we suggest reading an XML tutorial and an XSLT tutorial


Method

Sitekit CMS allows an 'XML Source' to be selected as a Function / Content Type for a page (under add/edit pages).

In order to add an XML Source Page use the following steps:

  1. Create a new page (CMS > Add/Edit Pages > New Page)
  2. Select a 'Parent Page' and type a 'Page Name'.
  3. The 'Page Title' and 'Page Title for Menu' should be auto filled. You nay wish to change these.
  4. Select 'XML Source' from the 'Function / Content Type' dropdown (It should be highlighted in yellow).
  5. Proceed to stage 2 by clicking 'Save' at the top or bottom of the page.
  6. You may enter a block of code or enter a URL, for both the XML source and the XSL source (example below).
  7. Save and publish the page.

Sitekit CMS will automatically consume the XML source page, process it in accordance with the XSLT and display it in the page when the page is requested.

Notes:

  • If you do not have access to this feature please contact your Sitekit Solutions Ltd. administrator to increase your rights within Sitekit CMS
  • The XML source may come from an RSS feed, or an XML version of a page, or from an external site.
  • You can find the XML version of the pages of any Sitekit CMS site by adding ".xml" to the end of the page name. For example to access the XML for http://www.sitekit.net/sitekit_products.htm you would use http://www.sitekit.net/sitekit_products.htm.xml
  • For security purposes the XSLT must be approved and signed by Sitekit Solutions Ltd. (you can request to have your xslt signed via http://www.sitekit.net/xsl-upload.html )
  • Once signed, the XSLT must not change.
  • There is no XML caching and feeds are represented as 'live'.
  • If any error occurs, Sitekit CMS will display a helpful error message on the display page. As a developer, this should help you resolve any problem. We advise viewing the page source for full details if an error occurs.

Example

You can see an example at http://www.sitekit.net/breaking-technology-news.html where the following are used

XML URL: http://news.bbc.co.uk/rss/newsonline_uk_edition/technology/rss091.xml

XSL Text:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="channel"><H1>Breaking UK Technology News</H1>
<p><xsl:value-of select="title"/><br />Last updated: <xsl:value-of select="lastBuildDate" /></p>
<xsl:for-each select="item">
<xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> <xsl:attribute name="target">_blank</xsl:attribute><H2><xsl:value-of select="title" /></H2></xsl:element>
<xsl:value-of select="description" /> </xsl:for-each><p><FONT size="1" xmlns="">
<xsl:value-of select="copyright" /></FONT><BR /><FONT size="1">The content of this page is
derived using an XML news feed from the BBC.</FONT></p></xsl:template></xsl:stylesheet>

Extended Features

Posting back to a Web Service

It is possible within an output page to post back to a webservice and filter on different criteria.

Any arguments passed in the querysting of any hyperlink within the XSLT (either hardcoded or generated dynamically via xslt) will be posted on the querysting to the XML source:

For example:

Let us assume the page http://www.sitekit.net/sitekit_products.htm

If we use the XML consumer (either as an XML Data Island or as an XML Source Page)

XML URL = http://www.url.net/source.xml
XSL URL = http://clients.gael.net/source.xsl

Then a hyperlink on the page which is output: <a href="http://www.sitekit.net/products.html?type=Reseller&Internal=true">

will result in
XML URL = http://www.url.net/source.xml?type=Reseller&Internal=true
XSL URL = http://clients.gael.net/source.xsl

You can view a real-life example of this at http://www.magic1054.co.uk/On-Air.html where the weekday links along the top pass an argument via the querystring to the webservice. The XSLT then consumes the new filtered XML and creates a page for that day.

Hiding Parameters from view

It is possible to hide the parameters which are passed by placing them directly in the XSL source URL (either of an XML Data Island or an XML Source Page). This is visible only within the admin system to a user with appropriate privelages, but will be hidden from a website viewer.

For example:

You may wish to pass a username and password to a webservice without revealing them to the end-user.

Let us again assume the page http://www.sitekit.net/sitekit_products.htm

If we use the XML consumer (either as an XML Data Island or as an XML Source Page) we can place a hidden argument within the XML source URL.

XML URL = http://www.url.net/source.xm?user=joe&amp;password=bloggs
XSL URL = http://clients.gael.net/source.xsl

Then a hyperlink on the page which is output: <a href="http://www.sitekit.net/sitekit_products.html?type=Reseller&Internal=true">

will result in

XML URL = http://www.url.net/source.xml?user=joe&amp;password=bloggs&type=Reseller&Internal=true
XSL URL = http://clients.gael.net/source.xsl

However the output page will have no reference to either username or password

Related questions