Tutorial: Understanding How Templates Work

When Stylus Studio creates a new stylesheet, it contains one template, which matches the root node. However, this template is empty. If you apply the new stylesheet as is, the result document has no contents. To generate a result document with contents, you need to add instructions to the template that matches the root node.

Default Templates

All stylesheets have two default templates that do not appear in the stylesheet itself. It is important for you to understand how the default templates work so that you can

  • Add instructions to the template that matches the root node.
  • Define additional templates to operate on the elements in your document.
  • Specify HTML markup in templates.

When you can do this, you can write a stylesheet that generates a dynamic Web page that displays your information.

About This Tutorial

This tutorial provides step-by-step instructions for defining a stylesheet that generates a dynamic Web page from an XML document. The tutorial shows how the default templates work, and it provides instructions for defining templates that instantiate the default templates. It also provides instructions for adding HTML markup to the stylesheet. The result is a dynamic Web page that displays the particular information you choose.

Each of the following topics contains instructions for defining the stylesheet. You should perform the steps in each topic before you move on to the next topic. After the first topic, some steps depend on actions you performed in a previous topic. This section organizes the process as follows:

For a simpler tutorial that shows you how to define a stylesheet that generates a dynamic Web page from a static HTML document, see Working with Stylesheets - Getting Started.

This tutorial duplicates some of the information in subsequent sections. For complete information, see the following topics:

XML Well-Formedness Checker & XML Indenter

Tidy up your XML documents with powerful integrated XML editing utilities including a single-click XML formatter, pretty printer, XML indenter and XML well formedness checker.

XSLT Editor

Stylus Studio's XSLT Editor is the most advanced XSLT development tool on the market. This powerful tool provides backmapping, XSLT transformation preview, debugging, peformance profiling, and more!

SQL/XML Tutorial

Many developers need to be able to write applications that work for databases from multiple vendors. This SQL/XML Tutorial refers to SQL/XML, XQuery, and Native XML Programming Languages to do just that.

Stylus Studio's Advanced XQuery Mapper Features

Learn how to create an advanced XQuery expression in the XQuery mapper, specifying operations, constants, and ports, for use in conditional blocks and FLWR expressions. Free online video demonstration!

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.