What is stylesheets?
- XML is not a fixed tag set (like HTML)
- XML by itself has no (application) semantics
A generic XML processor has no idea what is "meant" by the
XML
- XML markup does not (usually) include formatting information
The information in an XML document may not be in the form in which it
is desired to present it.
Therefore there must be something in addition to the XML document that
provides information on how to present or otherwise process the XML
What is the Advantage of separating content from style?
Contrary to when style information is hard-coded into the content, separation
of style from content allows for the same data to be presented in different
ways. This enables:
reuse of fragments of data: the same content should look different in
different contexts
multiple output formats: different media (paper, online), different
sizes (manuals, reports), different classes of output devices (workstations,
hand-held devices)
styles tailored to the reader's preference (e.g., accessibility): print
size, color, simplified layout for audio readers
standardized styles: corporate stylesheets can be applied to the content
at any time
freedom from style issues for content authors: technical writers needn't
be concerned with layout issues because the correct style can be applied later
What Does a Stylesheet Do?
A stylesheet specifies the presentation of XML information using two
basic categories of techniques:
An optional transformation of the input document into another structure
A description of how to present the transformed information (i.e., a
specification of what properties to associate to each of the various parts
of the transformed information)
Transformation capabilities
Transformation capabilities include:
generation of constant text
suppression of content
moving text (e.g., exchanging the order of the first and last name)
duplicating text (e.g., copying titles to make a table of contents)
sorting
more complex transformations that "compute" new information
in terms of the existing information
Description of information
Description of how to present the (possibly transformed) data includes
three levels of formatting information:
Specification of the general screen or page (or even audio) layout
Assignment of the transformed content into basic "content container
types" (e.g., lists, paragraphs, inline text)
Specification of formatting properties (spacing, margins, alignment,
fonts, etc.) for each resulting "container"