BASICS

ADMINISTRATION

DEVELOPMENT

SUPER ADMIN

  LAST UPDATED
5/22/2014

Introduction to XML

OU Campus uses XML and XSL functionality. These technologies are ideal for separating the content of a website from its architecture, and to combine and repurpose content and data. A current site that takes advantage of CSS can also be modified to take advantage of XML and XSL. In OU Campus template fileset, both the TCF file and TMPL file utilize XML. The TMPL specifies the usage of various XSL stylesheets. Additionally, OU Campus uses a XSLT transformation engine for processing. 

XML stands for Extensible Markup Language and consists of tags and elements. Every opening tag should have a closing tag. Tags can also self-close. A tag might self-close if the tag itself contains the data. XML was designed to be easy to use and create, human-readable and flexible enough to support other applications.

XML can be used to create a user-defined set of markup elements. For example, the following self-closing element defines both a nested element and the data:

<person name="Joe" />

It can also be expressed as follows:

<person>
<name>
Joe
</name>
</person>

XML 1.0 is defined by a W3C working group recommendations. The complete specification can be accessed at:

http://www.w3.org/TR/2008/REC-xml-20081126/

Here's an excerpt from the recommendation about well-formed XML documents:

Each XML document has both a logical and a physical structure. Physically, the document is composed of units called entities. An entity may refer to other entities to cause their inclusion in the document. A document begins in a "root" or document entity. Logically, the document is composed of declarations, elements, comments, character references, and processing instructions, all of which are indicated in the document by explicit markup. The logical and physical structures MUST nest properly...

Source: http://www.w3.org/TR/2008/REC-xml-20081126/ 

In other words, every xml document should have root node. The root node is the building block for the rest of the information. Programmers and programs can use root nodes to parse the root document.

Using XML/XSL, combinations of files can be used in a Lego-like manner to produce various outputs such as HTML for web pages, print-friendly HTML, CSV for spreadsheets, PDFs, etc. 

Diagram of XML, XSL, and the XSLT in OU Campus

Multiple Output

 

The use of XML/XSL technology takes place at the file level when you supply files in new types of formats. The keystone of OmniUpdate's XML/XSL implementation is via the use of a Publish Control File, PCF. OU Campus supports XSLT 1.0, 2.0, and 3.0. By default OU Campus uses XML-based templates, but also supports HTML-based legacy templates.

OU Campus templates usually begin with a prolog, which is option in XML. The prolog is included at the beginning of the file and must be before the root node. The  For example:

<?xml version="1.0" encoding="utf-8"?>
<?pcf-stylesheet path="/_resources/xsl/default.xsl" extension="html"?>
<?pcf-stylesheet path="/_resources/xsl/page2pdf.xsl" extension="pdf" alternate="yes" title="PDF"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">

To breakdown the example, the first part is the XML declaration. Minimally,

<?xml version="1.0"?>

The example also includes a definition of the encoding language...

<?xml version="1.0" encoding="utf-8" ?>

Encoding refers to the description of the language that is being used, or the symbols are being used. In this case, it is utf-8.

The next two lines in the example are processing instructions (PIs). Even though, processing instructions can occur throughout the document, if they appear before the root they are considered part of the prolog. In this case, the XSL stylesheets are declared for a PCF. As shown, pseudo-attributes, such as extension, alternate, and title can be included.

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


As shown, pseudo-attributes, such as extension, alternate, and title can be included.


Was this page helpful?

Additional Comments:


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

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