Beginning XML - Part II XML Style Language


In order to work with XML, it becomes necessary to know a little
about the XML Style Language.

XSL provides for two forms of output flow objects. The first set
is the set of displayable objects defined for HTML, which allows
XML data to be mapped into HTML-aware browsers. The second set is
based on the DSSSL-O specifications (Document Style Semantics and
Specification Language - Online), and allows XML data to be
mapped to DSSSL-based text formatters, such as JADE. Both sets of
flow objects are described using XML markup.

XSL defines a set of rules which define a set of actions that are
to be associated with various patterns of target elements. The
selection of target elements can be qualified in a number of
ways. For example, XSL allows different rules to be applied to
the same element type dependent on what its ancestors, siblings
or contents are. In addition, processing rules can be specified
for application when particular attribute values have been
associated with an element, or when the element has specific
contents. This means that specific rules can be applied to
elements with unique identifiers or identified content types
(classes).

XSL allows for the definition of sharable sets of style rules. A
style rule applies a set of processing characteristics to a
target element without creating a new flow object. Where the same
style is to be applied to a number of elements, a uniquely named
style can be defined for future reference. This provides XSL with
the facilities for creating cascading sets of style sheet
specifications similar in effect to those defined in the more
limited Cascading Style Sheet specification used to process HTML
documents.

XSL style sheets can use the ECMAScript programming language to
evaluate the contents of elements or attributes prior to or
during the creation of flow objects. ECMAScript is a variant of
JavaScript and Jscript that has been formally defined by the
European Computer Manufacturers Association. It allows tools
containing a Java Virtual Machine to process data contained
within an XML document. The language has been designed to support
only a limited set of processing side-effects to ensure that
evaluation cannot inhibit the progressive rendering of large
documents.

Now coming back to XML, it was originally developed to allow
structured documents of the type typically encoded in SGML to be
delivered over the Internet as an integrated part of the World
Wide Web of documents. Typically these documents require the
specification of element types over and above those permitted in
HTML (e.g. specific elements for parts number and other forms of
article identification, prices and other forms of calculable
measurements, and special classes of displayable text such as
health warnings and controlled task lists). XML allows users to
define their own sets of document elements and describe how each
of these elements should be displayed on a screen in conformance
with the supplier's house style.

One area where XML is anticipated to be particularly important is
in the area of electronic commerce.

Traditional mechanisms for electronic data interchange (EDI) are
based on the interchange of messages between the computer systems
of two or more businesses. Each message has to be decoded before
its contents can be processed or presented to users. Web-based
commerce has, by contrast, been based on the concept of
completing an HTML form and then posting the results back to the
server for processing, without any details of the transaction
being retained by the party completing the form.

XML-coded files are, by their nature, ideal for storing in
databases. Because XML files are both object-orientated and
hierarchical in nature they can be adapted to virtually any type
of database, though care sometimes needs to be taken to ensure
that enough structural data is retained in the database to
reconstruct the original file.

Data stored using non-XML notations will need appropriate
application software to process it, but the XML-coded file will
correctly identify where each piece of such data belongs in the
completed document and where it has been stored prior to use.

By storing data in the clearly defined format provided by XML you
can ensure that your data will be transferable to a wide range of
hardware and software environments. New techniques in programming
and processing data will not affect the logical structure of your
document's message. If more detail needs to be added to the file
all you need to do is to update the model and then add new markup
tags where required in the document instance. If a completely new
style is required then the existing document model can be linked
to the new one to provide automatic updating of document
structures.

About the Author

Amrit Hallan is a freelance web designer. For all web site
development and web promotion needs, you can get in touch with
him at http://www.bytesworth.com. For more such articles,
visit http://www.bytesworth.com/articles and
http://www.bytesworth.com/learn You can subscribe to his
newsletter [BYTESWORTH REACHOUT] on Web Designing Tips & Tricks
by sending a blank email at bytesworth-subscribe@topica.com