1 |
14 |
jlechner |
<html>
|
2 |
|
|
<body>
|
3 |
|
|
|
4 |
|
|
<h1>GNU JAXP XSL transformer</h1>
|
5 |
|
|
|
6 |
|
|
<div>
|
7 |
|
|
This package contains a Java XSL transformer compliant with the JAXP
|
8 |
|
|
specification. It depends on the GNU DOM and XPath implementations, and
|
9 |
|
|
will generate GNU DOM nodes unless a specific target from another
|
10 |
|
|
implementation was given. It understands DOM, SAX, and stream sources
|
11 |
|
|
and result sinks and supports these JAXP features.
|
12 |
|
|
</div>
|
13 |
|
|
|
14 |
|
|
<div>
|
15 |
|
|
To use this transformer, set the system property
|
16 |
|
|
<code>javax.xml.transform.TransformerFactory</code> to the value
|
17 |
|
|
<code>gnu.xml.transform.TransformerFactoryImpl</code>. You can then
|
18 |
|
|
instantiate <a href='TransformerFactory.html'>TransformerFactory</a>
|
19 |
|
|
and transformers in the ordinary manner. Reuse of stylesheets is
|
20 |
|
|
supported using the JAXP <a href='Templates.html'>Templates</a>
|
21 |
|
|
mechanism.
|
22 |
|
|
</div>
|
23 |
|
|
|
24 |
|
|
<h3>Architecture</h3>
|
25 |
|
|
|
26 |
|
|
<div>
|
27 |
|
|
When given a stylesheet source, this implementation compiles it internally
|
28 |
|
|
into a Stylesheet object, which is a container for templates and state.
|
29 |
|
|
Each stylesheet instruction is represented by a subclass of TemplateNode,
|
30 |
|
|
which is arranged in a directed graph: each TemplateNode has a reference
|
31 |
|
|
to its first child and the next node.
|
32 |
|
|
</div>
|
33 |
|
|
|
34 |
|
|
<div>
|
35 |
|
|
The transformation process consists of identifying the Template that matches
|
36 |
|
|
the root of the source context, and calling <code>apply</code> on its
|
37 |
|
|
corresponding TemplateNode. This in turn processes its children and next
|
38 |
|
|
TemplateNode, depending on the semantics of each node type.
|
39 |
|
|
</div>
|
40 |
|
|
|
41 |
|
|
<div>
|
42 |
|
|
Template nodes may reference XPath expressions or patterns. These are fully
|
43 |
|
|
compiled to objects of type <a href='../xpath/Expr.html'>Expr</a> at the
|
44 |
|
|
time the stylesheet is compiled.
|
45 |
|
|
</div>
|
46 |
|
|
|
47 |
|
|
<h3>Conformance</h3>
|
48 |
|
|
|
49 |
|
|
<div>
|
50 |
|
|
This implementation is feature complete, but the XSLT specification is
|
51 |
|
|
large and there are still many bugs that need to be ironed out. It has
|
52 |
|
|
been tested against the OASIS XSLT TC test suite, comprising unit tests
|
53 |
|
|
from the Xalan project and Microsoft. Conformance to these unit tests
|
54 |
|
|
is approximately 70% at the current time, although normal usage of the
|
55 |
|
|
transformer should involve relatively few surprises (the test suite is
|
56 |
|
|
designed to test very complex and obscure functionality).
|
57 |
|
|
</div>
|
58 |
|
|
|
59 |
|
|
<h3>Known bugs</h3>
|
60 |
|
|
|
61 |
|
|
<ul>
|
62 |
|
|
<li>When reusing stylesheets using the JAXP Templates mechanism, XSL
|
63 |
|
|
<code>apply-imports</code> instructions will not work.</li>
|
64 |
|
|
<li>XPath filter expressions do not always work as expected (this is a
|
65 |
|
|
problem with the GNU XPath implementation rather than the transformer).
|
66 |
|
|
This can result in problems with the <code>position()</code> function,
|
67 |
|
|
as well as <code>select</code> expressions and numbering.</li>
|
68 |
|
|
</ul>
|
69 |
|
|
|
70 |
|
|
<div>
|
71 |
|
|
Obviously we'd like to improve conformance and fix these bugs. If you're
|
72 |
|
|
interested in working on any of these issues please
|
73 |
|
|
<a href='mailto:classpathx-xml@gnu.org'>contact us</a>.
|
74 |
|
|
</div>
|
75 |
|
|
|
76 |
|
|
</body>
|
77 |
|
|
</html>
|