[WEB4LIB] CSS and XML

Thomas Dowling tdowling at ohiolink.edu
Fri Sep 15 14:54:36 EDT 2000




> I am unclear re. the relationship between XML and CSS.  I have built my
> library's site using CSS and HTML but in the long run, XML may be the
scripting
> language of choice within the larger intranet environment of which our
library
> is a part, especially as this organization builds web pages and other
electronic
> resources that employ Dublin Core metadata.  My understanding is that a
page
> written with XML absolutely requires an accompanying style sheet for it
to
> display in browsers, but can that style sheet be CSS or is there a
separate
> XML-related style sheet used for this purpose?   Thanks for any
insights.
>

XML is not a scripting language; it is a language for constructing
document markup languages.

Since XML allows authors to define their own structural document elements
(say, "<author>" or "<LCSubjectHeading>"), browsers cannot be know in
advance what a good default presentation is for all elements.  So it is
necessary to use stylesheets to define the intended presentation.
XML-aware browsers may have built-in stylesheets for some well known XML
languages, like XHTML.

CSS is one of two style languages people are using with XML; the other one
is XSL.  Since CSS also works with current HTML browsers, it has gotten a
lot more attention and a lot more people are familiar with it.  I know
little about XSL, but it seems to be both much more powerful and much more
complex than CSS, and has the potential to do much more than just apply
formatting to a document.  Details at <URL:http://www.w3.org/Style/>.

The first flavor of XML you use will probably by XHTML, which will let you
use all three of the ways HTML uses to call CSS.  For other XML languages,
the CSS2 spec suggests a processing instruction like:

  <?XML:stylesheet type="text/css" href="bach.css"?>

Dunno if that actually works, or with what browsers: let us know when you
find out.  :-)

Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu



More information about the Web4lib mailing list