This website produced with XsltFilter. The Page.Response buffer output is shown below.
Return to normal view of page
<? xml-stylesheet type="text/xsl" href="presentation.xsl" ?>
="CMS and XSLT
="Part 2 of the the presentation. Contains the CMS demos
This presentation contains the CMS related part of the talk I gave at WSG.
If you understand how to build a site using XSLT, then adding a CMS isn't that difficult. It simply
involves getting the XML data from a database, and managing some session details to indicate when a person is
actively editing the content blocks.
This is part 2 of this presentation. Read <a href
="Frequently Asked Questions
<question>How does this differ from normal CMS?</question>
Normal CMS systems rely on storing the content in a database, and formatting that information via code. Using XSLT
relies on storing the XML data in a database, and letting the XSL processor transform the XML into HTML as it sees fit .
<question>Which system do I use?</question>
I have written my own CMS using ASP.NET. Since I use XsltFilter, the CMS simply outputs XML and knows nothing of any
transformations taking place.
="Using XSLT with Content Management Systems
CMS systems which use XML and XSLT are very flexible, and much easier to implement than a traditional CMS system.<br
A comparison of the methodolgies should highlight the differences between them. For this comparison, we
will assume that a vendor is implementing an established CMS for a new client.
="Storing the data
A XML based CMS uses a single table to store the content in an XML format. This differs from a traditional CMS
where there is a different table for each different type of content.<br
="Comparing the data storage needs
<XML>no re-development (every implementation is identical)</XML>
<Trad>re-develop the database to match the CMS requirements</Trad></comparison>
="Editing the content
No matter what type of CMS is implemented, there must always be forms and form handlers to edit the CMS data.
With a traditional CMS you must also develop the database side of things for each implementation.
="Comparing the development of an editing system
<XML>develop a form to display each type of content</XML>
<XML>develop a form handler to convert the text from each form into XML</XML>
<Trad>develop a form to display each type of content</Trad>
<Trad>develop a form handler for each form</Trad>
<Trad>write code to read each type of content from the database</Trad>
<Trad>write code to store each type of content in the database</Trad></comparison>
="Displaying the data
Use XSLT to transform that XML content into whatever HTML is defined in the XSLT stylesheet. (Note: If you have
chosen to use XSLT for the site, then there is no additional work to display the CMS based content.)
="Comparing the development required to display the content
<XML>write XSLT template rules to format the XML as HTML. (req even if no CMS used)</XML>
<XML>every placeholder automatically finds the matching template rule (zero development)</XML>
<Trad>development required to read the CMS data from database</Trad>
<Trad>development required to format the database content as HTML.</Trad>
<Trad>each placeholder must be correctly coded</Trad></comparison>
="In place edit-links for the CMS
My CMS uses in-place edit links for the content blocks. Some people who are used to traditional CMS's seem amazed when they see
this as it is so simple to use, and they wrongly assume it must be hard to implement. It is actually easier to implement.
The basic concept is:
An example is shown below...
<li>You must use XSLT to figure out what HTML is generated. This is a pre-requisite.</li>
<li>When in normal mode, the content block contains only the XML content.</li>
<li>When in Content Editing mode, the CMS wraps a <ContentEntry> tag around the content block.</li></ol>
="XML Content block
The XML for a typical content block would look like this.
<para heading="">Coming Soon... (honestly)</para></code>
="Same XML Content Block when in editing mode
When the CMS is placced into editing mode for the session, it adds a <ContentEntry> tag around the content.
This <ContentEntry> tag is transformed into in-place editing containers on the page, and within the editing
container, a call is made to <xsl:apply-templates/> which then
automatically finds the standard template rule for that content.
<para heading="">Coming Soon... (honestly)</para></ContentEntry>
<img src="cms_inplace1.jpg" width="208" height="53" alt="A CMS block ready to be editing" border="0"/></section>
="Sample CMS page
This is an example of the code for a CMS driven page.
The page runs in a DotNet environment - it's a standard ASPX page, though I use an '.xf' extension to
clearly differentiate the pages made using <a href
other ASPX pages.
Notice how there is almost no code, and the intent of the code is very clear.
<?xml-stylesheet type="text/xsl" href="styles/demo.xsl"?>
<MainPageContent heading="CONTACT US>
<%= Content.GetXml("ContactUs","para") %>
And yes, this page works, and work well. Those 7 lines are really all thats required to have a CMS based website.
PS: In this example, the 'Content' object has been declared in the Global.asax
PPS: I would normally inherit the page class from a custom written base class that provides the XML headers and <page> node,
making this page only 3 lines long... but that would make the example less clear.