The jd.xslt XSLT processor was written by Johannes Döbler of Munich, Germany. This processor supports XSLT Version 1.1 (see http://www.w3.org/TR/xslt11). XSLT 1.1 was withdrawn by the W3C in favor of XSLT 2.0, which is now under development. Nevertheless, Version 1.1 offers several interesting features, including the script element, not available under XSLT Version 1.0. The script element allows you to define extensions within a stylesheet, something like the function element in XSLT 2.0. You can read more about the jd.xslt processor at http://www.aztecrider.com/xslt/. A.2.1 Downloading and installing jd.xsltFollow these steps (which may vary over time) to download and install jd.xslt:
A.2.1.1 Running jd.xsltOne option is to copy the JAR file jdxslt.jar from the lib directory of the archive to one of the chapter directories under C:\LearningXSLT\examples directory. Placing the JAR in a working directory obviates the need to deal with the Java classpath (see Section A.1.2, earlier in this appendix). Test to see if jd.xslt works by typing the following line at a command prompt: java -jar jdxslt.jar This should give you: jd.xslt processor version 1.5.2 Usage: java jd.xml.xslt.Stylesheet [options] xml [xsl...] xml the uri of an input xml document, "-" for STDIN xsl... zero or more uris of stylesheets - if their number is = 0: use the associated stylesheets of the xml document = 1: transform the input with that stylesheet > 1: chain the transformations the uri "urn:jdxslt:identity" denotes the identity transformation options: -entityresolver <cls> set a sax EntityResolver -errorstack show the java call stack in case of an error -media <media> filter associated stylesheets by their media attribute -msglistener <class> set a message listener -out <file> write the output to the file (default is System.out) -out:<prop> <value> set the value of a xsl:output property -param <name> <expr> set the value of a toplevel parameter (expr is a context- free XPath expression). Multiple parameters are allowed -parser <class> set a sax parser -parserxml <class> set a sax parser for input xml documents -parserxsl <class> set a sax parser for the stylesheet -proxy <url> set a proxy host -repeat <number> repeat the transformation n times -security <class> set a XsltSecurityManager -title <title> filter associated stylesheets by their title attribute -trace create trace output -uriresolver <class> set a UriResolver -validate validate xml documents -verbose turn on verbose mode to display transformation info -w0 recover silently from recoverable errors -w1 report recoverable errors and continue (default) -w2 treat recoverable errors as fatal java -jar saxon7.jar test.xml test.xsl To transform a file, use the following: java -jar jdxslt.jar test.xml test.xsl To transform a source file with more than one stylesheet, use the following line: java -jar jdxslt.jar test.xml test1.xsl test2.xsl test3.xsl To send output to a file, use the -out option: java -jar jdxslt.jar -out test.out test.xml test.xsl Set an output property (based on the attributes of the output element) using the -out: option: java -jar jdxslt.jar -out:indent yes test.xml For verbose output, use the -verbose option: java -jar jdxlst.jar -verbose test.xml test.xsl If the source document has an associated DTD, you can validate it at runtime with the -validate option: java -jar jdxslt.jar -validate test.xml test.xsl A DTD will be associated with the XML document by a document type declaration, which will look something like: <!DOCTYPE test SYSTEM "test.dtd"> A.2.2 Using xmlspyAltova's xmlspy is available for download from http://www.xmlspy.com. You can get a free trial before purchasing a license. (This is the only XSLT processor I am demonstrating that isn't free.) I should note, however, that xmlspy runs only on the Windows platform. Assuming that you have successfully installed xmlspy, follow these steps.
Figure A-1. xmlspy with files loadedFigure A-2. xmlspy dialog boxFigure A-3. Result of transforming message.xml with message.xslA.2.3 Using xRay2Architag's xRay2 is a free, graphical XML editor with XSLT processing capability. It is available for download from http://www.architag.com/xray. xRay2, like xmlspy, runs only on the Windows platform. Assuming that you have successfully downloaded and installed xRay2 according to the easy instructions provided by Architag, follow these steps to process a source document with a stylesheet.
Figure A-4. message.xml in xRay2Figure A-5. message.xsl in xRay2Figure A-6. Result of transforming message.xml with message.xsl in xRay2 |