Introduction to XML and XSLT
- Presentation vs. Content - Form vs. Function
- One of its main benefits is the total separation of content
and presentation information - between what the data means, and
how it should be displayed to users. For example, instead of
using HTML tags to define what size some text should be on the
screen (such as <font size="+3">), an XML document
would use tags to specify what the text block signifies (such
as <chaptertitle>).
- examples of HTML
tags - some for form, some for function
- examples of XML tags
used in EJ database
- eXtensible (eXtensible Markup Language. ) - XML allows
you great flexibility to define the specifics of the content
you want to mark up. Like HTML, XML contains tags "<...>"
for describing elements. Unlike HTML, XML by itself does not
define any specific tags, but only describes a way to define
your own tags. But this does make it more difficult to exchange
data with others' implementations. Standards and tools for such
exchange are being developed.
- XSLT is a part of the XSL style sheet language, focused on
transforming one XML object into another, and is extensively used
throughout our projects.
- Online Bookstore examples:
- Currently, this transformation is the most tricky part. Not
only do we have to use XSLT to manipulate the XML data into the
look we want to present, we have to use some complicated scripting
to get the output to display correctly on different browsers.
This gets more difficult when dealing with Chinese characters.
Many of the technologies are still in a developmental stage.
- By separating the content from presentation, we can use different
XSLT style sheets to display the information in different
ways for different needs, or even to show different portions
of the data.
- Those using WAP phone might trigger an XSLT document to extract
and display only the most relevant information in a style appropriate
for their small screens. And different XSLT documents might be
used for authenticated versus public access.
- Where to do the transformation? On the server or the client
browser?
- We chose to perform the transformations on the server:
- Can be overly resource-intensive (slow) on older computers.
- We know we have the tools on the server, the clients may
have different versions, be incompatible with our transformation
goals, or be unable to handle XML documents.
- Greater data security - if needed, we can authenticate the
user, and only send those portions of each record which they
are authorized to see.
For much more information on XML and related standards, visit
http://www.xml.com/ and http://www.w3.org/
Also take a look at "Using
XML and XSLT to process and render online journals"
if your institution has a subscription to the electronic version
of Library Hi-Tech.
last revised 6 December 2001
©HKUST Library