Hello World: A Basic XSL Stylesheet

Posted 2009-05-05 in Technology | XSL | XML | Text

Developing a site with Symphony CMS starts with a basic XSL stylesheet. This is the traditional “Hello, world” example.


First, create the home page. Navigate to Blueprints : Pages and click on the Create New button.

The Index Page

The index page is a special type of page that is designated as the root of your site. There can only be one page with a type of index. If the home page does not have the index page type assigned to it, Symphony will throw an error:

The page you requested does not exist.

Other pages do not require a page type, so, for all other pages, the Page Type field is optional.

URL Handle

The URL handle is the text string that can be used to identify an entry in a URL. If you do not specify a URL handle, Symphony automatically modifies the string supplied in the Title field, transforming uppercase characters to lowercase characters and turning space characters into hyphens to create the handle.

Use the following settings to configure the page:

URL Settings
  • Parent Page: /
  • URL Handle: home
  • URL Parameters: (none)
Page Metadata
  • Events: (none)
  • Data Sources: (none)
  • Page Type: index (this is important)
Page Data
  • Title: Home
  • Body: (see the page template below)
  • Utilities: (none)

The Page Template

Symphony uses XSLT as its templating system. XSLT is a W3C recommendation. It’s strength is in its ability to transform XML into XML, Text, HTML or XHTML with the ability to use conditionals, recursion, and a number of math and string manipulation functions. This skeleton XSL stylesheet provides the minimum necessary to create a web page with an XHTML 1.0 Strict doctype.

                      <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    indent="yes" />

<xsl:template match="/">
    <h1>Hello, world</h1>



View the example XSLT template and HTML output.

So, you can have one XSL stylesheet that contains several XSL templates that do a number of different things. But, we’ll find out about that later. Just be aware that everything is based on XML, so everything has to be “well-formed” or “valid” XML. And that includes the HTML.

DesignProjectX | The digital sandbox of Stephen Bau