Intro to XML and XSL
OU Campus uses XML and XSL to build and create pages. XML is a syntax that stores page data and content, while XSL is a transformation language that transforms that data into the published web page.
XML, eXtensible Markup Language, is a widely-used format for storing data as text so it can be later accessed by XSL or other software. Unlike HTML, XML doesn't have a set of predefined tags; it has some very specific syntax requirements, but the overall data structure is entirely up to the developer using it. Invalid XML that doesn't follow correct syntax leads to parsing errors on PCF pages.
As such, any HTML brought into OU Campus PCFs must be made XHTML compliant to ensure they follow XML syntax rules and avoid XSL parsing errors. Three common causes of parsing errors are:
- Open tags.
Unlike HTML, all tags in XML must close, either as self-closing tags or full tags.
- Boolean attributes without values.
A boolean attribute can be listed without a value in valid HTML. However, XML requires all attributes to have associated values, so add a value repeating the name of the attribute.
- Special characters not encoded.
XML treats certain special characters in a unique manner. Any instances of those characters which appear in page content need to be encoded appropriately using HTML entities.
Watch the following video to learn about the basics of XML from Yves Lempereur, Chief Product Architect of OmniUpdate.
eXtensible Stylesheet Language is a pseudo-programming language originally built to convert XML structures into different XML structures. However, it has evolved to a powerful tool in terms of its output capabilities and functional abilities. It can transform XML into a number of different products, including .html, .aspx, or .php files.
XSL has three main advantages:
- Server-side Agnostic
Due to its decoupled nature, OU Campus supports all server-side languages. XSL can output any textual content including server-side code, thereby supporting many different production server types and configurations, including outputting basic PHP and C# to the source of the page to call that language. Common languages such as PHP and C# can be output easily by default, but XSL can work with just about any server-side language.
- Programmatic Logic & Efficiency
XSL provides similar functionality to a server-side language, handling that work on OU Campus servers and thus minimizing the work needed by the servers hosting the final products. By reducing the load on server-side scripts and outputting static files, users visiting the live site will experience faster load times than a site powered by server-side scripting alone.
- Separation of Content from Design
By storing only the content and settings that are specific to each page in XML (
.pcfextension), developers and administrators can modify the global design in a single location (XSL) without the need to individually fix every page.
Watch the following video to learn about developing in XSL, once again presented by Yves Lempereur.
External references on XSL and XML: