[topicmapmail] stupid question?
W. Eliot Kimber
eliot@isogen.com
Thu, 29 Aug 2002 09:35:10 -0500
Lars Marius Garshol wrote:
> no need for a library that can do the job for you. *That* is what we
> really need, so that people can forget about using XSLT for something
> it is eminently unsuitable for.
I agree with Lars: we have done a few experiments within ISOGEN with
both generating and publishing topic maps in a variety of ways,
including using XSLT directly against XTM instances and our experience
with using XSLT has suggested that it is not the most effective, or even
an effective, way to do topic map processing in general.
While it is possible to use XSLT to process XTM documents, there are a
number of hard things that it is difficult at best to do in XSLT,
especially dealing with topic merging and scopes. Not impossible, just
difficult. It would also be difficult to prove that a given XSLT style
sheet conforms to the Topic Map reference model, simply because there
would be no way to instantiate the implicit abstract topic map the XSLT
script is operating on (which is not the same thing as saying you
couldn't write an XSLT script to generate some stringified topic map
reference model instance, just that that script couldn't be the same one
that implements your business logic because XSLT provides no way to
build an accessible data model in memory as you can in say Java or
Python or C++).
I think that if you need a no-license-cost solution then using TM4J, as
an example, is an excellent way to go--it handles all the scoping and
merging for you and provides a reasonably easy-to-use API for accessing
the abstract topic map. If you can do DOM programming you can use TM4J.
You could use it to directly generate HTML or generate an intermediate
XML form that you then apply simpler XSLT style sheets against. You can
also use it to generate a normalized XTM instance in which all topics
are merged, but you'd still have to be able to deal with scope, which is
pretty hard to do in XSLT (how do you write an XSLT template that can
determine that the scopes specified by two characteristics are the same
scope). Also, determining that a topic is a member of a particular
association role is also a hard problem that is not easily solved in
XSLT.
It would also be possible to integrate something like TM4J with an XSLT
processor to provide utility functions that do merging and handle scopes
and association role membershipo, although I'm not sure off the top of
my head exactly how that would work (your style sheet would still need
to be prepared to deal with the possibility of merging in some way if
you're not process pre-merged and normalized XTM instances).
If the XML community had a general API for mapping arbitrary data
structures to a common data model that could then be processed by XSLT,
it would be less of an issue--you could use any TM engine to express the
abstract topic map in this data model and then it would be available for
XSLT processing in a much easier-to-process form that wouldn't require
the generation of intermediate XML instances [hint: see grove4j project
on Source Forge].
Cheers,
E.
--
W. Eliot Kimber, eliot@isogen.com
Consultant, ISOGEN International
1016 La Posada Dr., Suite 240
Austin, TX 78752 Phone: 512.656.4139