Creating a New Sample Stylesheet

To create a stylesheet to use in this tutorial, follow these instructions:
1. From the Stylus Studio menu bar, select File > New > XSLT: Text Editor.

Stylus Studio displays a new untitled stylesheet and the Scenario Properties dialog box, and selects the text in the Scenario Name field.

Figure 165. Scenarios Let You Easily Test Different XSLT/XML Pairs

2. In the Scenario Properties dialog box, in the Scenario Name field, type DynamicBookstoreScenario.
3. Click Browse to the right of the Source XML URL: field.

Stylus Studio displays the Open dialog box.

4. Navigate to the Stylus Studio examples\query directory.
5. Double-click bookstore.xml. This is the XML document that the new stylesheet will operate on.
6. In the Scenario Properties dialog box, click OK.

This creates a scenario with the name DynamicBookstoreScenario. This scenario associates the bookstore.xml document with the new stylesheet. If you want to apply the new stylesheet to other XML documents, you must create a new scenario or change the name of the XML document in this scenario.

Stylus Studio displays the new stylesheet in the XSLT editor. A tree representation of the bookstore.xml document appears to the right.

Figure 166. The XSLT Editor Shows XSLT Source on Left, Tree on Right

The default stylesheet that Stylus Studio creates contains one template, which matches the root node.

7. In the XSLT editor tool bar, click Preview Result .

Stylus Studio displays the Save As dialog box so you can save the XSLT you are composing.

8. In the URL: field, type bookstore.xsl and click Save.

Stylus Studio applies the new stylesheet to bookstore.xml and displays the result in the Preview window. The result, displayed in the Preview window, has no contents because the template that matches the root node is empty.

9. In the XSLT editor pane, click in the empty line that follows <xsl:template match="/"> .
10. Type <x, which displays the Sense:X completion list.
11. In the completion list, scroll down and double-click xsl:apply-templates.
12. Type />.
13. In the XSLT editor tool bar, click Preview Result . This time, the Preview window contains all text in bookstore.xml and none of the markup. This is because the xsl:apply-templates instruction instantiates the default templates.

Figure 167. Default Templates Contain No Formatting Instructions
14. In the Stylus Studio tool bar, click Save .

To create a Web page, you need to add HTML markup that displays the information the way you want. To make it easier to do that, you need to understand how the text is already being copied to the result document.

EDI to XML Mapping in Stylus Studio

Learn how to use Stylus Studio's EDI to XML mapping tools in Convert-to-XML, including loading an EDI file, inspecting application control codes, customizing XML output and other advanced EDI to XML mapping features.

Using DataDirect XQuery with Stylus Studio

Learn how to query any relational database using XQuery and the XQuery API for Java using DataDirect XQuery, an embeddable Java component, and Stylus Studio the world's leading XML IDE.

The Stylus Studio Advantage

Read in their own words, why customers have decided to make the switch to Stylus Studio, the World's best XML editor.

Learn XQuery Visually

Stylus Studio offers three infomative XQuery demonstration videos illustrating Stylus Studio's XQuery Editor, Mapper, Debugger and other advanced functionality. Watch them today!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member