Home Books Software Projects Forums

XSLT by Example

Introduction (below)

Creating XHTML compliant output.
How do you specify that your XSLT output conforms to XHTML?
What is XHTML and why is it important?
Who is advocating for HTML standards?
What are the major differences between HTML and XHTML?
What is XHTML Transitional?
How can you validate your XHTML?
What tools are available for XHTML development?
Where are the DTD's located for XHTML?

Using XSL keys for performance.
Why do we need XSL keys?
What's an example of an XMI ID?
How is an XMI ID used as a reference?
How are keys defined?
What does the XSLT processor do with XSL key declarations?
How are keys used?
Is it fast?

Using templates for modularity.
What is a template?
How do you invoke a template?
How do you sort the nodes matched by a 'select' expression?
Is it possible to pass parameters to a template?
Can you transform a single node into more than one result?

Using flow control for conditional processing.
How do you conditionally perform a transformation?
How do you iterate over a set of nodes in a result set?
How do you create a comma separated list?
How do you select from amongst a list of possible results?

Writing XPath expressions and using variables.
What is XPath?
How do you find all instances of an element in a document?
How do you limit your results to only elements that contain a specific attribute?
How do you get the value of an element?
How do you get the value of an attribute?
What are variables?


If a picture is worth a thousand words, then how much is a good code example worth?

Thanks to a suggestion from one of our readers, we have developed a companion set of pages to our Transforming XMI to HTML pages. In those pages we present an XSLT stylesheet for displaying a UML model in a web browser. The focus is on the structure of XMI as a representation of a UML model and on the transformations used to render this model into HTML.

These pages, entitled XSLT by Example, shift the focus toward the nitty-gritty details of writing XSLT stylesheets. The example is the same - our XSLT stylesheet. Only the focus has changed.

It is our hope that these companion pages will assist our faithful readers in getting a better understanding of this powerful, new technology called XSLT. If you have any suggestions for improvements, they would be much appreciated.

Valid XHTML 1.0!