Datasheet

12
Part I Introducing XML
CSS
Because XML allows arbitrary tags in a document, the browser has no way to know
in advance how each element should be displayed. When you send a document to a
user, you also need to send along a style sheet that tells the browser how to format
the tags you’ve used. One kind of style sheet you can use is a CSS style sheet.
Cascading style sheets, initially invented for HTML, define formatting properties such
as font size, font family, font weight, paragraph indentation, paragraph alignment,
and other styles that can be applied to particular elements. For example, CSS allows
HTML documents to specify that all
H1 elements should be formatted in 32-point,
centered, Helvetica bold. Individual styles can be applied to most HTML tags that
override the browser’s defaults. Multiple style sheets can be applied to a single
document, and multiple styles can be applied to a single element. The styles then
cascade according to a particular set of rules.
CSS rules and properties are explored in more detail in Chapters 12, 13, and 14.
Mozilla, Opera 4.0, Netscape 6.0, and Internet Explorer 5.0 and later can display
XML documents with associated CSS style sheets. They differ a little in how many
CSS properties they support and how well they support them.
XSL
The Extensible Stylesheet Language (XSL) is a more powerful style language designed
specifically for XML documents. XSL style sheets are themselves well-formed XML
documents. XSL is actually two different XML applications:
XSL Transformations (XSLT)
XSL Formatting Objects (XSL-FO)
Generally, an XSLT style sheet describes a transformation from an input XML docu-
ment in one format to an output XML document in another format. That output
format can be XSL-FO, but it can also be any other text format (XML or otherwise),
such as HTML, plain text, or TeX.
An XSLT style sheet contains templates that match particular patterns of XML ele-
ments. An XSLT processor reads an XML document and an XSLT style sheet and
compares the elements it finds in the document to the patterns in the style sheet.
When the processor recognizes a pattern from the XSLT style sheet in the input
XML document, it instantiates the template and outputs the resulting text. Unlike
cascading style sheets, this output text is somewhat arbitrary and is not limited to
the input text plus formatting information. It depends on the instructions in the
template.
Cross-
Reference
03 549863 Ch01.qxd 1/28/04 9:46 AM Page 12