|
Home >Online Product Documentation >Table of Contents >XSLT Scenarios XSLT ScenariosThis 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.) You can define multiple scenarios using different settings to see how each affects document processing. Stylus Studio also supports scenarios for Web service calls, XQuery, and XML pipelines. 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. 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. 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.
Working with ScenariosTo 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 PreviewWhen 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 DocumentThis 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.
2. In the left tool bar of the Preview window, click Preview Text
. Stylus Studio displays the HTML file that generates the browser display.
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. |