Dynamically Choosing Style Transformations
The options that you’ve looked at so far for
associating documents with transformative processes are quite
capable. Often, the use of stylesheet processing instructions, or
simple AxKit processor definitions, combined with constraints imposed
by Apache built-in <Files>,
<Directory>,
<Location>, and similar block-level
directives, are all you need to meet the needs of many sites.
However, AxKit offers even more flexibility by providing additional
mechanisms that allow you to combine these low-level style processing
options into logical groups that can be
selected at runtime. In this section, I introduce the concepts and
syntax for creating
named
styles and media types and explain
how these can be used in conjunction with the
StyleChooser and
MediaChooser modules to apply just the
right content transformations under the right circumstances.
The reasons for using named style and media blocks are quite varied. Generally, they are best suited for cases when you need to select a transformation (or a chain of transformations) based on a condition external to the properties of the source XML content itself. Some reasons to use named styles and media blocks include:
- Vendor branding
Your site offers a service, and each customer wants the content presented in a way that matches his unique look and feel.
- User-selected skinning
One size never fits all. You want to offer your visitors the ability to select the style that suits them best.
- Automated metadata ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access