Introduction to XSL
XSL (eXtensible Stylesheet Language) is a style sheet language for XML documents. Just like CSS is used to tell the browser how to display an element in a special design, font, or color, XSL is used to describe how the XML document should be displayed (transformed). The different components of XSL are:
XSL Transformations (XSLT): A language used for transforming XML documents.
XPath: A language used for navigating in XML documents.
XSL-FO: A language for formatting XML documents, where FO refers to formatting objects.
An important concept to understand is that XSLT is the most important part of XSL. Using XPath to navigate the structure of the XML document, XSLT transforms an XML document into another XML document.
XSL Basics Video
XSL Basics from OU Campus Training on Vimeo.
Standard XSLT 2.0 Document Structure
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "http://commons.omniupdate.com/dtd/
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/
<xsl:output omit-xml-declaration="yes" />
XML is a simple and human readable way of interchanging structured document between computer systems. An XML document is a great way of storing data and one of its fundamental qualities is to separate data from presentation. Since there is a clear separation of data and presentation of the document, it becomes easier to transform a document from one form to another. This is where XSL comes into play since XSL comprises XPath, which can be used to navigate through an XML document. XSL uses XSLT to transform a document to a virtual document (for other software systems) or use XSL-FO to create standard documents.
XSL Transformations in OU Campus
In OU Campus, every PCF (XML) document goes through a transformation call, where the XSL file (based on the pcf-stylesheet declaration) and the XML file are passed over to the transformation engine. Upon a successful transformation, OU Campus takes the transformed document and creates a suitable preview. If the listed XSL file in the pcf-stylesheet declaration is missing or if the XSL/XML file is invalid, the user is prompted with the appropriate error message.
A single PCF file can contain multiple pcf-stylesheet declarations; in such a case, each pcf-stylesheet declaration goes through an individual transformation call and upon successful transformation, each pcf-stylesheet declaration will create an individual file.