Re: Should I use XSLT or DOM

Subject: Re: Should I use XSLT or DOM
From: keshlam@xxxxxxxxxx
Date: Thu, 15 Jun 2000 12:04:59 -0400
>The destination tree will be
>different from the source tree with element
>and attribute values from the source tree
>becoming element/attribute values of a
>totally different tree structure.

No problem. XSLT allows you to completely reorganize the data; that's one
of its major advantages over the relatively simple CSS model.

Your example's a bit too fuzzy to come up with specific examples -- you
show the reorganization, but it isn't clear what principles are being
applied to produce that result. Still, there should be plenty of XSLT
examples out there demonstrating this capability and the principles behind
it. Basically, an XSLT template can specify a mixture of

     What kinds of nodes it will be applied to
     What data gets pulled out of the source document (from the current
node or others)
     What happens to that data (what markup it's combined with to generate
the output)
     Which other nodes should be considered for further processing.

Moving data around is just a matter of adjusting where you look for it and
what you wrap around it.

As to whether to use XSLT or the DOM -- That depends on the details of the
problem, the level at which you want to work with it, who you expect will
be maintaining this in the future. XSLT's a higher-level language, which
means some things are more elegant and some are less so. Driving things via
pattern-matching, as XSLT does, may make your tranformation more robust if
the document's structure changes... or may just mean that it fails
silently. Screw guns make poor hammers, hammers make poor screwdrivers, but
each can do some things better than the other.

Joe Kesselman  / IBM Research

 XSL-List info and archive:

Current Thread