Using Diazo, you could apply this theme to your dynamic website as follows:
- Identify the placeholders in the theme file that need to be replaced with
dynamic elements. Ideally, these should be clearly identifiable, for
example with a unique HTML
- Identify the corresponding markup in the dynamic website. Then write a "replace" or "copy" rule using Diazo's rules syntax that replaces the theme's static placeholder with the dynamic content.
- Identify markup in the dynamic website that should be copied wholesale into
<head />are often treated this way. Write an Diazo "append" or "prepend" rule to copy these elements over.
- Identify parts of the theme and/or dynamic website that are superfluous. Write an Diazo "drop" rule to remove these elements.
The rules file is written using a simple XML syntax. Elements in the theme and "content" (the dynamic website) can be identified using CSS3 or XPath selectors.
Once you have a theme HTML file and a rules XML file, you compile these using the Diazo compiler into a single XSLT file. You can then deploy this XSLT file with your application. An XSLT processor (such as mod_transform in Apache) will then transform the dynamic content from your website into the themed content your end users see. The transformation takes place on-the-fly for each request.
Bear in mind that:
- You never have to write, or even read, a line of XSLT (unless you want to).
- The XSLT transformation that takes place for each request is very fast.
- You can leave the original theme HTML untouched, which makes it easier to re-use for other scenarios. For example, you can stitch two unrelated applications together by using a single theme file with separate rules files. This would result in two compiled XSLT files. You could use location match rules or similar techniques to choose which one to invoke for a given request.
We will illustrate how to set up Diazo for deployment later in this guide.