BASICS

ADMINISTRATION

DEVELOPMENT

SUPER ADMIN

  LAST UPDATED
10/20/2012

Stylesheets

XSL stylesheets can be defined as XML documents which contain XSLT commands used to transform the contents of XML documents into many more friendly human readable forms such as HTML and XHTML. Contained below are some examples which can used to assist in the creation of XSL stylesheets.

The Process

The process of creating XSL stylesheets and XML content can seem daunting at first, but done properly the results can be quite powerful and rewarding. To begin the process, you'll first need an XML document to style. This XML file should contain all of the content that your page will display and have a file extension of .PCF (which will classify it as a Publish Control File). Once you have such a document in place, the content portion of our XML/XSLT combination is complete. The look and feel of your content will be supplied by an XSL stylesheet. Much like an HTML document references a CSS file to provide formatting an XML document references an XSL stylesheet to provide the formatting that visitors will see.

PCF Example - faculty-directory.pcf

Download Source (Zip file)

XSL Stylesheet Example - faculty-directory.xsl

Download Source (Zip file)

Using an XSL stylesheet

To call an XSL stylesheet from an XML document you will need to add a line much like the following to the beginning of your PCF file:

<?pcf-stylesheet path="/faculty-stylesheet.xsl" extension="html"?>

If you open the PCF example file referenced above, you will see this line at the top of the file. For more information about the attributes and usage of this processing instruction, please see our documentation on PCFs.

Styling XML Content with XSLT

Now that you have your PCF file referencing your XSL file, it's time to start structuring how you'd like your XML content to be displayed and formatted. We will accomplish that through the use of the XSL tags and some XPATH values similar to the following:

<xsl:value-of select="document/title" />
<xsl:copy-of select="document/content/node()" />

For a complete reference of all XSL tags available to you, feel free to check out our XSL Reference.

Combining XML/XSLT to create HTML

Once you have your PCF file referencing your XSL stylesheet and displaying properly within OmniUpdate, you can publish the page. When instructed to publish a PCF file. OmniUpdate generates the appropriate files on your production server based upon the PCF and XSL files on the staging server.


Was this page helpful?

Additional Comments:


(Include your email address if you would like a reply)

Procede to http://support.omniupdate.com/