Spring's Mojo is XSLT
Sunday, November 27, 2005I'm really digging this CMS. At its heart it serves up your data as XML and you apply XSL templates. And right there is a freedom you don't find in many content management systems. Most CMS are, as Adrian says, 'tag soup'. You make html templates and embed propriatry tags to pull out your content in predefined ways. By serving up XML, Spring allows you to do anything you like via XSLT. Here's a simple example.
The default blog listing template pulls out a field called 'description' for display on the home page, it's a metadata field that's also used for Dublin Core stuff and so on. I didn't want to do use that so I made a simple change to the template:
From this:
<xsl:value-of select="xml/pagexml/description" /> to this:
<xsl:choose>
<xsl:when test="string(html/p[@class='summary'])">
<xsl:copy-of select="html/p[@class='summary']"/>
</xsl:when>
<xsl:otherwise>
<p class="summary">
<xsl:value-of select="xml/pagexml/description" />
</p>
</xsl:otherwise>
</xsl:choose> Which first checks to see if there's a <p> element in my page's html with a class of 'summary', and if so it'll copy it into the home page listing, otherwise it'll just use the description field.
It may not seem significant at face value, but look at what I was just able to do:
- Create my own semantic element
- Manipulate it in my template
How many CMS application let you do that eh? Here's another more advanced example from the man himself.
4 Comments
Man what is this?Did I fall asleep and miss out when people were learning this stuff?I feel VERY insecure... Help... HELPHelp me understand! I need to know what this all means!!!!!!!!!!!AAAAAAAAAAAAAARFGGGGGGGGGGGG
Hey thanks for the nice comments! I think another good example of how empowering the CSS/XHTML/XSLT/XML workflow is, is the very fact that in only a few hours we were able to turn Spring into something resembling a blog - purely using XSLT... no database changes or php changes. Cool! -- Adrian
Hi, is it possible to download springCMS and give it a try?
Cheers, Alex
Hi Alex, you should direct you queries thusly:
http://www.millstream.com.au/view/products/