The processing model of XSLT
XSLT
(eXtensible Stylesheet Language Transformations) is a W3C specification for a
document manipulation language capable of restructuring XML documents and
performing computations on their elements. An XSLT style sheet contains template
rules, each of which has a pattern specifying the node it matches and a template
to be instantiated, and an output when the pattern is matched. When an XSLT
processor transforms an XML document using an XSLT style sheet, it traverses the
XML document tree reading each node in turn. The processor compares each node
with the pattern of each template rule in the style sheet. When the processor
finds a node that matches the pattern of a template rule, it outputs this
template. The template generally includes some markup, some new data, and some
data copied out of the source XML document. XSLT has some weaknesses in its
functionality (e.g., limited text processing), and hence XSLT extensions are
useful. Some applications require the development of new XSLT extensions, in the
form of either an extension function or an extension element.
Above picture shows
the processing model which uses the XSLT extension function to perform the
encryption defined in DSL. It consists of the following three major components:
Keys,
algorithms and security patterns definitions in DSL.
This comprises the key definitions, algorithm definitions, and security
patterns.
DSLTransform.
This is an XSLT extension object that is implemented in Java. It takes
arguments to load the required keys, executes algorithms described in DSL,
and then returns a DOM fragment (the result of an encrypted node) to the
XSLT processor. These Java functions are called during the transformation
process using a Xalan processor.
The
XSLT style sheet.
This contains some DSL templates and predefined templates. Each DSL template
specifies the path of the node to be encrypted and the corresponding
encryption rule. Note that the DSL template is also a transformation
template of the XSLT.
Let us assume that the target XML document ready to be encrypted is X. The XSLT processor reads X and then traverses it. Whenever it reaches a node in X, it checks if there is any specified path of some DSL template that matches the location of this node. Whenever such a DSL template exists, the XSLT processor encrypts the corresponding node according to the encryption information stored in the template. The encryption information contains security algorithms and encryption and decryption keys.
(Currently, the software package can only be installed in Windows serial and our present version of extension function object can be executed in J2SE v 1.3.x)
1. Prerequisite Software: Download and install them.
JavaTM 2 Platform, Standard Edition (J2SETM) from http://java.sun.com/j2se/1.3/download.html
Cryptix JCE from http://www.cryptix.org/products/jce/ (Extract to C:\cryptix-jce)
Xalan-Java
(XSLT Parser) from http://archive.apache.org/dist/xml/xalan-j/
(
2. Download extension function object of XSLT: XSLTransform.zip (Extract to C:\)
3. Set up the Java classpath
You must include cryptix-jce-api.jar, cryptix-jce-compat.jar, cryptix-jce-provider.jar, cryptix-jce-tests.jar, DSLParser.jar, DSLAlgorithm.jar, xml-apis.jar, xercesImpl.jar, xalan.jar in your Java classpath.
You can also execute the batch file "C:\XSLTransform\setupclasspath.bat" to add required Jar files to Java classpath.
4. Please refer to http://xml.apache.org/xalan-j/samples.html for the details of running examples.