First experiences with XSL
Harmison,Mark
Mark_Harmison at wb.xerox.com
Sat Jan 31 01:13:26 GMT 1998
Michael Kay wrote:
> I've downloaded MSXSL and used it to generate HTML for a couple of document
> types, successfully but with a certain amount of frustration caused by (a)
> lack of diagnostics when I got things wrong, and (b) limited functionality.
>
> I've now implemented the same thing without XSL: I wrote an MSXML
> application in Java that does a recursive walk down the document tree and
>calls a registered "handler" class to process each element type. I added a
> number of helper methods such as isFirstOfType() to allow the handlers to
> get information about their context more easily.
>
...
>Any XSL enthusiasts want to prove me wrong?
--------------------
These are interesting points and should spark some good discussion.
I have had a long-standing interest in a notion of "compiled"
stylesheets. Compiled stylesheets would be generated from interactive
tools, similar to today's stylesheet editors. The editor would output
formatting source which could be compiled with a standard compiler
(such as Java or C++). The rendering engine would then simply call
the compiled functions for each element. Both speed and richness in
the run-time environment would be improved over run-time stylesheet
interpretation.
However, the stylesheet editor must have a way of storing the
designer's original intend. XSL provides a good declarative syntax
and metaphor for doing this. Non-programmers can understand "rules",
"patterns", "actions", and "flow objects" pretty well. A stylesheet
editor can read and write XSL easily and reliably. Because XSL is
declarative, it is much easier for a program to read it than a
procedural specification of formatting would be.
Here's a suggestion: If you want faster formatting than a given XSL
processor can give you, or you want access to the system in a way not
possible through the declarative language, you write a program which
turns a declarative XSL stylesheet into a compilable program which can
then be extended using the compiled language. The best of both worlds.
Having said all that, I've been doing stylesheet junk for about 5 years
and used a bunch of different system and performance of the stylesheet
engine is not usually the problem. Access and extensibility are more
commonly the trouble. Where a good escape to native code or a good
"scripting language" mechanism has existed, these have been plenty.
I am both a programmer and sometime-stylesheet person. I can tell for
much experience that programmers get really bored doing stylesheet
type programming (just like we got bored writing reports and forms).
So, we invent tools to let "lesser mortals" do that work ;-), hence
stylesheet languages. If you really want to write stylesheets in
Java, have fun, but I bet the fun won't last more than a few weeks.
Mark Harmison
Xerox Corporation
Mark_Harmison at wb.xerox.com
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list