Tools and Relatively Painless How-to
for Working with XML and XSL/T on Windows and Mac
John Robert Gardner, Ph.D.
ATLA-CERTR
Emory University
These instructions will get you started, use the sample files linked here (Mac and Windows) in order to start out right away, if you want to work with Sanskrit and Vedic! Otherwise, transfer your own and use these instructions to get you started. Special thanks to Chuck White and the XSL/T FAQ from Dave Pawson for getting me started.
1. To Use the Example Files for Articles (IJTS/EJVS) and your own sources on Windows:
The "engine" that makes XSL/T files do what they do, which is free, is XT by James Clark. Clark offers it for free, working on Unix and Windows.
The best way to do this is to have a Pentium II or better and 20mb of hard disk space. The easiest way to run XSL/T files is to first get a copy of Internet Explorer 5 for Windows (to see which version you have, start up IE, go under "Help" to "About . .. " and it will tell you). You can do this by selecting IE5 and your operating system at http://www.microsoft.com/downloads/.
After you've installed it (follow all the pre-set switches so that the install happens transparently without affecting your system), then get the version of James Clark's XT for Windows 95 or 98 (often referred to as "Windows32" which specifies the new versions, 95 and 98, which only run on 32-bit processors), called xt.exe from http://www.jclark.com/xml/xt.html, or direct ananymous FTP from ftp://ftp.jclark.com/pub/xml/xt-win32.zip. Once it's downloaded (be sure to remember where you told your browser to put it), open that folder and double-click on the xt-win32.zip file. The WinZip application already on your system should open up, and follow the auto prompts to unzip XT, setting a new directory for RV work. If WinZip doesn't open, you can get your own free by searching for "WinZip" at http://www.zdnet.com/downloads/specials/free.html. You may be able to short-cut the whole process by going directly to http://hotfiles.zdnet.com/cgi-bin/texis/swlib/hotfiles/info.html?fcode=000015.
When you unzip XT, tell WinZip to put it in a directory you can remember, such as "c:\RVwork\." Then all your files for this technology can be kept in one place. Get the Windows sample files which are also zipped, and put them here, and unzip them with WinZip too (they are also at http://vedavid.org/xml/docs/).
Restart Windows, make sure that you have Internet Explorer 5 (IE5), and you should be ready. To run an example, you have to work in MSDOS. Go to Start, Programs, MSDOS Prompt. You should have a window with a simple DOS command-line prompt. Type:
cd\RVwork
And hit the "Enter" key (assuming you have an RVwork folder on your c:\ drive according to the instructions above. You're now in the directory for working with XSL/T and XT.
To see what all is there, type
dir
and hit "Enter." Choose the XSL/T script you want to use (remember, all files must be in your RVwork folder where xt.exe is), and run xt by typing as follows:
xt rv_ejvs.xml add_attr.xsl test.xml
Hit Enter and the process happens. You can check the results by opening the result file, test.xml, in a simple word editor like WordPad (Start, Programs, Accessories), choosing Open File, and in the Open File window, specifying at the bottom center pull-down "Files of Type" menu "All Documents," and then picking test.xml. This is also a good program to use for making your own changes to the scripts to begin learning more. Just always save as text only, no extra formatting.
In the command above, "xt" invokes the XSL/T processor called xt.exe. Then "rv_ejvs.xml" tells it to start with the RV supplied with this article for performing the commands determined by "add_attr.xsl," the XSL/T instruction script described in this paper. You can give any name for the output file, called here "text.xml."
2. To Run XSL/T Scripts with XT on a Mac< (Either your own, or IJTS/EJVS files)/b>
First, you need to download the EJVS sample files for Mac, and get the Java for Mac that has JBindery. It comes with the MRJ SDK. You can find the MRJ 2.1 SDK (MacIntosh Runtime for Java Software Development Kit) for free at http://developer.apple.com/java/text/download.html#sdk (it takes a few minutes from home, less on ethernet). Now install it by double-clicking the icon, following all the automatic presets. When it's done, you will see the MRJ SDK 2.1 directory on your hard drive, with a JBindery folder (if not, trash MRJ, reinstall with custom, and select ALL components).
Now you need the files for XT, from James Clarks site. Be sure to choose the Java versions, not the Windows. You will need XT and XP. Get them from http://www.jclark.com/xml/xt.html, or direct anonymous FTP from ftp://ftp.jclark.com/pub/xml/xp.zip and ftp://ftp.jclark.com/pub/xml/xt.zip. Unzip these and put all the XT files in one folder called "xt" inside the JBindery folder of the MRJ SDK 2.1 folder on your hard drive. Do the same with XP (except put its files in the JBindery folder in their own folder called "xp").
Next UnStuff the EJVS files (double-click on it and it should launch Stuffit, if not, get a copy here http://www.zdnet.com/mac/download.html by searching for "Stuffit Expander"). Inside the resulting EJVS_supplementary_files folder, open the "mac" folder and put all its contents inside the JBindery folder you must do this for the scripts to work. Do not just put the "mac" folder itself in, but move its contents into JBindery, in addition to the rv_ejvs.xml file inside the main EJVS folder.
To run a Mac XSL file, double-click on the application, e.g., "jrg's_when_test" and you will see an output file in XML appear in the directory. Use BBEdit Lite to open the file (get a copy at http://www.zdnet.com/mac/download.html by searching on BBEdit). When you choose Open from the File menu, be sure to set the "File Types" to "Any File."
For viewing the results of the search and select_hymn actions in a browser, after you've run the "jrg" applet, then run the matching "view" applet, and open the HTML file which results in a browser.
If you want to make your own applets after you have more experience with XSL/T, and change the input and output file names, just run "JBindery" itself, choose "Open" under file, and select any "jrg" applet, and change the file names in the "Command" window such as seen here:
Then "Save as Application" in the JBindery folder with whatever name you wish, leaving the other selections as I have preset them.
Likely as not, you may also encounder Not Found/Directory Path errors. That comes from a trickier screen. If you look at the JBindery window, the lefthand icon list has a "Properties Icon" and this could be a source of troubles. You need to add the following two lines to the bottom left and bottowm right window (it'll spill over the viewable space of the window, so type carefully), respectively:
jclark.xsl.sax.parser
com.jclark.xml.sax.Driver
You should also have the appropriate ".jar" files in your "Classpath" window. Assuming you've unzipped stuff all to the JBindery directory, your window should look like this:
For Mac users, I also recommend a copy of VirtualPC so you can run Windows programs (yes, for real) on your PowerMac. In the long run, you'll benefit in multiple ways from having Windows on your Mac. And, the big secret is, Windows runs more stable on a Mac!
3. To Edit XSL Files
It is important to experiment to learn more. Change small things at first. Also, if you are technically inclined, bring your questions to the XSL list. To subscribe, go to Indology (if you haven't already), review the rules and how to join at: http://www.ucl.ac.uk/~ucgadkw/indology.html.
On a Mac, I recommend using BBEdit Lite which is free ( http://www.zdnet.com/mac/download.html, and perform a search on "BBEdit, and select 4.6), and it assures that your files will be saved correctly. On Windows, open the file in Microsoft WordPad (go to Start, Programs, Accessories, WordPad). To open an XSL file, youll need to tell the "Files of Type" menu, which is at the bottom center of the window that pops up when you choose "Open" from the File menu, to show "All Files." You will want to be sure and only change those variables, indicated in the article above, in the parts of the script marked off between the rows of asterisks.
4. To Display or View Selected XML Output Files in a Browser
Sometimes you may not need to see just code, but want to view the files for easier reading and study, like in a browser.
On Windows, run XT with whatever filename of the XML you want to view in a browser, and the convert_to_browser_view.xsl file like this:
C:\xt mytextoutput.xml convert_to_browser_view.xsl viewit.html
Notebe sure and put ".html" at the end of the output file, or your browser may not read it in formatted form. You can open it in a browser by choosing "Open file" and/or Browse from your browsers file menu (browsers can open files on your hard drive just like files on the net).
For MacIntosh, just run the "view" applet that matches the "jrg" file name whose output you want to see, such as jrgs_select_hymn would have its output converted to a browser viewable html file with "view_selected-hymn." The resulting HTML file will be in your JBindery directory, and you can open it from the file menu of your browser by choosing "open file" or "open page."
Special thanks goes to Chuck White for pioneering the Mac territory for XT use ( http://www.javertising.com). His initial notes are available as part of an excellent Q & A source by Dave Pawson at http://freespace.virgin.net/b.pawson/xsl/sect4.html#N6860.
Dissertation | XML Home | Other | atman@vedavid.org |