Home About Publications Projects Resources Search
IJTS Logo
ISSN 1084-7553

IJTS
Special Edition
June 2000
Table of Contents
Abstracts
Magically Storming the Gates...

IJTS Sections
IJTS Home
About the Editors
Aims of the IJTS
Editorial Policy
Distribution Policy
Copyright Policy
Current Issue
Back Issues
How to Submit
Members' Benefits
Members' Login
 
 
Magically Storming the Gates of Buddhahood:
Extensible Text Technology (XML/XSLT)
as a Simulacrum for Research
 
by John Robert Gardner
Introduction / Extensible Markup Language and the Birth of E-textnology / Specifics of XML / Extensible Stylesheet Language for Transformations and XPath / XSL Transformations and the Study of Mantra / Conclusion / Appendix 1: Tools and Resources for Working with XML and XSLT / Appendix 2: XPath Primer / Bibliography

Appendix 1: Tools and Resources for Working with XML and XSLT

1. To Use the Example Files. The "engine" that makes XSLT files do what they do, which is free, is XT by James Clark. Clark offers it for free, working on Unix and Windows. For Mac users, I recommend a copy of VirtualPC so you can run Windows programs (yes, for real) on your PowerMac. In a forthcoming issue of Electronic Journal of Vedic Studies, I have instructions for the Mac, and some different XSLT scripts. The tools for doing this are free, and it’s fairly easy (see http://vedavid.org/xml/docs for links to the instructions). 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!

The best way to do this is to have a Pentium II or better (or the equivalent with VirtualPC, if you don’t want to install MRJ SDK—free from Apple’s web site--on a Mac), and about 250 Mb of hard disk space.

The easiest way to run XSLT 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 anonymous 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 sample files which are also zipped, and put them here, and unzip them with WinZip too.

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 XSLT and XT.

To see what all is there, type

dir

and hit "Enter." Choose the XSLT 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_4_ijts.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 XSLT processor called xt.exe. Then "rv_4_ijts.xml" tells it to start with the RV supplied with this article for performing the commands determined by "add_attr.xsl," the XSLT instruction script described in this paper. You can give any name for the output file, called here "test.xml."

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 and see if it's in your ballpark of understanding, go to http://www.mulberrytech.com/xsl/xsl-list. If you are more new to the X-nology world and prefer colleagues from within your discipline, subscribe to Indology (if you haven't already), review the rules and how to join at: http://www.ucl.ac.uk/~ucgadkw/indology.html.

2. To Add more XML Tags. Pick one of the XML editors as described above.

If you are adding your own notes and comments, marking passages, or organizing your own files of data, then you will want to use an XML editor such as those at the links provided in the Appendix. For Windows, WordPerfect 2000 is the best and easiest to use. Of all these tools, it is the most "costly"-but still quite reasonable at less than $100 educational price. On a Mac, at the same price is the Pro version of Media Design in-Progress's Emilé. For free, on Windows there is a wide variety. I prefer the simple approach which concentrates on keystrokes rather than some fussy graphic interface, in a product called XED. On the Mac, the Lite version of Emilé is the best.

Important: the advantage of working with an XML-automating software such as these is that they make it nearly-certain that all the rules are followed, so your files will work the first time. If you just type your own, typo's can make errors which violate the XML rules.

You can get XED, or a range of other possible XML editors free to try and use, at http://www.xmlsoftware.com. You can get Emilé for the Mac at http://www.in-progress.com. They include instructions for their use.

For a few dollars extra, WordPerfect 9 in WordPerfect Office 2000 is great for XML tagging, and even doing your own work with DTD's.

Appendix 2: XPath Primer

XPath is the set of rules by which literally any level—even a word or letter—of a text may be accessed by and XSLT template command.

If you are familiar with the old days of DOS, this will be easier to pick up. If not, do not be dismayed, I've designed the sample so you can just change the names of tags and words sought to still use this tool and learn as you go (again, I encourage readers to discuss this on the lists for everyone's benefit—no matter what level of knowledge with which you begin). In DOS—as on every computer—the basic organization of your files is according to folders or directories. Just like in a file cabinet, a folder contains various papers. Think of your hard drive as a file cabinet, with each drawer being a set of folders. On a Windows machine, think of the "My Documents" folder. In it you may have sub-folders and in those you have distributed all your various files.

DOS does the same thing, but it had abbreviations for file names so you didn't have to type them all the time. In your My Documents folder, if you wanted to go down to another folder, you'd use a change directory command, and a series of "\" symbols to separate each subfolder's name. To go up to the folder level above where you were—say from "publications" up to the My Documents level—you'd use a ".." symbol. The only difference in XSLT is that the slashes are "/" (pointing "forward"), and instead of moving in directories, you were moving up and down nested tags or elements. So, in XML syntax, the file "myarticle.doc" file in the "publications" folder of "My Documents" on your computer would be:

<hard drive>
<My Documents>
<publications>
myarticle.doc
</publications>
</My Documents>
</hard drive>

Or, to give the reverse example for how elements in a document are accessed according to the "/" syntax of XPath, here's an XPath statement of where you would find a mantra in the RV: "//mandala/hymn/verse/mantra." The "//" means "start here." If you wanted the gaayatrii, you know it's verse 10 of RV 3.62. In the tagging system of the sample file used here, you would find it this way: //verse[@id="rv3.62.10] using the notion that attributes are contained in the element or tag where they're declared. You could also say //mandala/hymn/verse[@id="rv3.62.10]" but there is no need to re-type all those element names where you can just use "//" to say "begin looking for what I want at the 'verse' level." Of course, there are certain functions of XSLT where you need to declare all that if you are matching more than just the verse level, but that goes beyond the realm of what's needed for the included examples. You can learn more at http://www.w3.org/1999/11/xslt-xpath-pr and also at http://www.xml.com, or read my forthcoming book from Prentice-Hall, The XSLT and XPath Handbook written with Zarella Rendon.

Next: Bibliography
Prev: Extensible Stylesheet Language for Transformations and XPath
Top: Appendix 1: Tools and Resources for Working with XML and XSLT