506. XML Presentation
Rev. 1.01
This two-day module presents various techniques for presenting XML
documents in a web browser. First, Cascading Style Sheets (CSS, mostly level 1,
some level 2) are applied to XML documents directly. Then students learn some
basic XPath and XSLT to make transformations to HTML in the browser. Simple
XLinks are studied, with hands-on exercises, and extended XLinks are discussed
and a non-working example is presented. Finally, students work with client-side
scripting using JavaScript and the Document Object Model (DOM) to manipulate
and enhance the XML document and presentation in the browser, and to respond to
user events for a responsive graphical interface.
Note that this course does not cover CSS, XSLT, or the DOM in exhaustive
detail. Students who already know CSS or DOM for use with HTML will get great
leverage from this course. Those who do not know these technologies coming into
the course will have no trouble learning them to the moderate depth presented
here, and will be well prepared to pursue them in greater detail.
The module presents what might be called “Pure XML”, by which we
mean two things. Firstly, everything in the module is based strictly on W3C
specifications, without any vendor-specific extensions. Secondly, no knowledge
of any particular programming language or other external technology is required
to participate fully in the module. Thus the hands-on exercises, and the
knowledge that is developed, are portable and applicable to any XML authoring
or development effort. (Separately, Object Innovations also offers courseware
in XML and Java, for instance, and XML in the .NET framework.)
LEARNING OBJECTIVES
·
Use cascading stylesheets to present XML documents
directly in a web browser.
·
Use basic XPath and XSLT to transform XML documents
into HTML for web presentation, with or without associated CSS.
·
Express relationships between XML documents using
simple XLinks.
·
Understand the potential for extended XLinks in a
document base or website.
·
Write scripts into an XML document that use the DOM to
manipulate the document in the browser, to enhance its presentation or filter
content.
·
Write scripts that handle browser-interpreted user
events (such as a button click) to modify the XML document and presentation in
the browser.
Course Duration: 2 days
Prerequisites: OI
Module 501 or similar. Ability to read and to write well-formed XML.
1. Styling
XML
XML and HTML
Cascading Style Sheets
Selectors and Properties
CSS Layout Model
CSS for HTML
CSS for XML
Limitations of CSS
2. XML-to-HTML
Transformations
XSL and XSLT
XSLT on the Client
XSLT Output Formats
XPath
Structure of an XSLT Stylesheet
Literal Replacement Elements
Dynamic Content
Conditional Processing
Sorting and Filtering
3. Linking
XML Documents
XLink
Elements as Links
Simple Links
Show and Actuate Attributes
XML Base
Extended Links
Link Sets and Linkbases
Local Resources
XPointer
4. Scripting
Using the DOM
Client-Side Scripting
JavaScript (ECMAScript)
DOM for HTML
DOM for XML
Scripts in XML Documents
Parsing the XML Document
Modifying the XML Document
Responding to User Events
Learning Resources
Quick Reference: XPath and XSLT
System Requirements
Software for this course can be installed and run on Windows or
Linux systems. A variety of command-line XML tools must be installed for
parsing, transformation, and schema validation. These are all free downloadable
tools and all can be installed and run on Windows or Linux. See the appropriate
course Setup Guide for details. Note that presentation examples have only been
successfully tested on Netscape 6; there are problems running on IE 6.
Hardware requirements are not great; a good minimal system for this
course would have a Pentium 200MHz or equivalent CPU, 64 meg of RAM and at
least 50 megabytes of free disk space for tools installation (and most of this
is for the web browser).