XSLT in Perspective
James Clark
jjc@jclark.com
XSLT
XSL Transformations
W3C Working Draft
Nearly finished
Two documents
XSLT
XPath
Transformation is Important
XML pointless without transformation
Stylesheets
Styling is a transformation between
source (semantic) structure
presentational structure
Stylesheet languages differ in kinds of supported
transformations
Transformation
in DSSSL
Presentational structure is not SGML
Two transformation languages:
transform to SGML
transform to flow object tree
Transformation
in XSL
Presentational structure is XML
One transformation language
Better modularity
Easier to understand
Two
Kinds of Transformation
Push
Pull
XSLT supports both
Push
Transformations
Rule based
Output structure dependent on input structure
Typically for transforming documents
Same approach as DSSSL/CSS (and most style languages)
Pull
Transformations
Template based
Output structure independent of input structure
Typically for transforming data
Same approach as server pages
Push/Pull
Mix
XSLT allows mixing push/pull within a single
transformation
Documents contain islands of highly structured data:
semantic tables
front matter
Data contains semi-structured fields
Push/Pull
and XPath
Push requires matching
Pull requires querying
XPath defines query language
XPath also works for matching
Example: chapter/title
Not
for Everything
XSLT is not a general-purpose XML
transformation language
XML can represent arbitrary data of arbitrary
complexity
General-purpose XML transformation requires
general-purpose programming language
What's the Point?
Why not just use a general-purpose programming
language?
Allow non-programmers to do some transformations:
without tools, only simple things
with tools, more complex things
Optimizable
Incremental
What Kinds of Transformations?
XML to XML transformations
Transformations on structure
From more to less structured
Input structure expressed in hierarchy
Non-XML Transformations
Represent lexical structure in XML:
Trivial transformation into XML
Complex XML-to-XML transformation
Trivial transformation out of XML
TeXML
Relationship to Other Standards
XML Schemas
XLink
DOM
CSS
XML Schemas
Defining class of input documents for an XSLT
stylesheet
Refinement
Type/tag distinction
XLink
Problems:
Out of line links
Ranges
Substrings in text nodes
DOM
Should be possible to use the DOM to invoke:
XSLT
XPath
Important for client-side use of XSLT
CSS
Less powerful transformations
CSS2 adds text before/after
Adequate for simple documents
Use less powerful language when you can
Summary
XSLT makes XML useful for non-programmers
http://www.w3.org/TR/WD-xslt