Transform XML documents with XSLT in a graphical environment.
Graphical XML editors almost universally offer built-in XSLT transformations now. This hack will show you how to transform XML documents with XSLT in xmlspy, xRay2, and <oXygen/>.
Altova's xmlspy 2004 is a Windows-only graphical XML editor, which you can download from http://www.xmlspy.com. As you install xmlspy, you can get a free license for the Home Edition. Assuming that you have downloaded and installed xmlspy, follow these steps to transform time.xml with clock.xsl (you saw a brief example of this in the hack that discussed creating an XML Document from a text file [Hack #18] ):
Open the file time.xml with File Open from the working directory (the directory where you extracted the file archive for the book).
Choose View Text view.
Open the file clock.xsl with File Open, also in the same working directory as time.xml.
Choose View Text view again. At this point, xmlspy should appear as it does in Figure 3-1.
Click on the time.xml window to give it focus.
Press F10 or choose XSL XSL Transformation, and the "Please choose XSL file" dialog box appears, as shown in Figure 3-2.
Click the Browse button, select clock.xsl, and click OK.
Another window appears showing you the result of the transformation. Choose View View text. The result appears in Figure 3-3.
Architag's xRay2 is a free, graphical XML editor that runs only on the Windows platform. Like xmlspy, it has XSLT processing capability. You can download it from http://www.architag.com/xray.
After you have successfully downloaded and installed it, follow these steps to perform a transformation with xRay2.
Open time.xml with File Open from the working directory.
Open clock.xsl with File Open in the same location.
Choose File New XSLT Transform.
In the XML Document pull-down menu, select time.xml (see Figure 3-4).
In the XSLT Program pull-down menu, select clock.xsl (see Figure 3-5).
If it's not checked, check Auto-update.
The result appears in the transform window as shown in Figure 3-6.
SyncRO Soft's <oXygen/> is a graphical XML editor that runs on the Windows, Mac, and Linux platforms. Like both xmlspy and xRay2, <oXygen/> can process documents with XSLT. You can download a trial copy from http://www.oxygenxml.com/download.html/.
After you have downloaded and installed <oXygen/>, follow these steps:
Open time.xml with File Open from the working directory (see Figure 3-7).
Choose Xml Configure transformation scenario, then click New. The Edit scenario dialog box appears.
Name the scenario "Time," click the browse button, and open clock.xsl (see Figure 3-8). Click OK.
In the Configure transformation scenario dialog box, click Transform now. The result appears in a tabbed pane at the bottom of the <oXygen/> window (see Figure 3-9).
Marrowsoft's <Xselerator> is an XSLT editor and debugger: http://www.marrowsoft.com/Products.htm
Sonic Software's Stylus Studio includes an XSLT editor, debugger, and mapper: http://www.stylusstudio.com/