The complexity of a tree-to-tree transformation - how can it be minimized? In many situations, XSLT is probably the single best answer - the template principle is extremely effective in abolishing complexity. But are there other approaches which might in certain scenarios be alternatives or complement the XSLT principle? Here comes a train of thought considering a principle from the realm of chemistry.
(1) A catalyst may speed up a chemical reaction by orders of magnitude. Especially when large molecules are involved (biology!), the key mechanism is *spatial*: leading the partners of the reaction into spatial proximity and aligning the positions of key parts.
(2) Can the spatial alignment of large molecules be compared with structural alignment of large documents? The spatial alignment is achieved by rotating, turning, tilting .... A structural alignment might be achieved by applying certain simple operations which leave the tree semantics intact, yet change the structural expression: flattening hierarchy, adding hierarchy (grouping), inverting hierarchy (swapping parent-child), ...
(3) To illustrate, please consider this transformation
A
. B
. . C
=>
b
. a
. . c
By a simple inversion of hierarchy, the target would become
a
. b
. . c
and the complexity of the complete transformation would be reduced to two summands, (a) the operation of inversion, (b) a list of renamings. The first summand is very small, as it could be expressed by a short string resembling a function call, like: invert-hierarchy(/b, a). So the overall complexity would be (arguably) reduced.
I wonder if anybody can report similar approaches supported by *tools*? And, of course, I would be interested in your thoughts about this reasoning.
Hans-Jürgen Rennau