Transform an XML Document Within a Graphical Editor
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.
Figure 3-1. time.xml in xmlspy
Figure 3-2. Choosing an XSL file in xmlspy
Figure 3-3. Result ...