XSLT Scenarios

This topic is part of a sequence. If your-quotes.xsl is not open, see Opening a Sample Stylesheet. The sequence starts with Exploring the XSLT Source Tab.

To apply a stylesheet to an XML document in Stylus Studio, you use a scenario. A scenario is a group of customizable settings that allows you to experiment with different source XML documents (that is, the XML document to which you will apply the XSLT), processors, parameter values, post-processors, and profiling settings. You can also use scenarios to perform validation on the XML document that results from the XSLT processing. (Validation is always performed before any post-processing you specify.)

Figure 27. Scenarios Let You Easily Test Stylesheets and XML Source

You can define multiple scenarios using different settings to see how each affects document processing. Stylus Studio also supports scenarios for Web service calls, DB-to-XML Data Sources, and XQuery.

An XSLT scenario is defined by a single stylesheet-XML document pair. You can associate any number of scenarios with a stylesheet, though only one scenario can be in effect at the time the XSLT is processed. Similarly, you can associate any number of scenarios with an XML source document.

Tip

 

Stylus Studio lets you work with several XSLT processors, including Xalan-J, MSXML .NET, and Saxon.

A scenario has already been created for the your-quotes.xsl stylesheet, using the your-quotes.xml as the source XML document. Run the scenario now and look at the output created by the XSLT defined in your-quotes.xsl.

To run a scenario, click Preview Result .

Stylus Studio processes the source XML document using the XSLT stylesheet you specify and displays the results in the Preview window.

Figure 28. XSLT Processing Results are Shown in the Preview Window

By default, results are displayed using a Web browser. If you choose, you can display results in tree or text format, by clicking Preview in Tree and Preview Text in the Preview window tool bar.

Use the scroll bar to review the HTML in the Preview window. You can see that the values come from the XML document your-quotes.xml.

Tip

 

If it is not already open, you can open the source XML document specified in a scenario by clicking Open XML From Scenario in the XSLT Editor tool bar.

Working with Scenarios

To define additional scenarios, click the down arrow next to the scenario field in the XSLT Editor tool bar, and click Create Scenario. After you have more than one scenario, click the same down arrow to select the scenario you want to use to preview a result.

To change the properties of a scenario, or to delete a scenario, select the scenario you want to change or delete, and then click Browse to the right of the scenario name field. Stylus Studio displays the Scenario Properties dialog box.

About Preview

When you preview a result, Stylus Studio automatically saves the changes you have made to the document. If you want to revert to the document's previous state, you can use the undo function ( Edit > Undo).

Working with a Sample Result Document

This topic is part of a sequence. If your-quotes.xsl is not open, see Opening a Sample Stylesheet. The sequence starts with Exploring the XSLT Source Tab.

To work with a sample result document, follow these steps:
1. In the Preview window, click anywhere in the display.

Using its back-mapping functionality, Stylus Studio displays the template in the XSLT Editor's status bar and flags the line that generated the line you clicked with a blue pointer.

Figure 29. Back-mapping Shows which XSLT Generated a Result

2. In the left tool bar of the Preview window, click Preview Text . Stylus Studio displays the HTML file that generates the browser display.

Figure 30. You Can Render XSLT Results as Plain HTML
3. Click anywhere in the HTML display. The gray background identifies any HTML that was generated by the same template.

This works in reverse as well. If you click a line in a template (full source mode or template mode), Stylus Studio uses a gray background to display the HTML generated by that template.

4. In the left tool bar, click Export Preview . Stylus Studio displays the Save As dialog box. If you want, you can enter a file name and click Save to preserve the generated HTML file. Otherwise, click Cancel.
Note

 

Notice the tab at the bottom of the XSLT Preview window. It specifies your-quotes [your-quotes.xsl]. After you create another scenario and apply the stylesheet in that scenario, another tab with the name of that scenario will be displayed. You can click the tab for the result you want to view and easily compare result documents from different scenarios.

MySQL XML Tools

The MySQL tools in Stylus Studio simplify XML related development tasks for working with MySQL and XML.

Join Us: Apply for a Job at Stylus Studio Today

Join our team of XML professionals and help us in our mission to create the most productive XML tools and components on the planet. Apply today!

XML Applications

XML Applications are software applications that process data using standard XML technologies like XML, XML Schema, XSLT and XQuery. Using Stylus Studio XML Pipeline, learn how to model, edit, test and deploy an XML Application with ease.

Advertise with Stylus Studio

Need to get your products and/or services in front of millions of qualified enterprise XML developers? Partner with Stylus Studio, the world's largest XML developer community!

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.