The interesting challenge is to work out when you can
discard parts of
the tree that won't be needed again. I think this could be
done quite
easily for a small class of very simple stylesheets, but
the general
problem is quite hard.
I think it should be possible to assert by static analysis
whether a certain template only accesses descendants of the
context node. If this can be asserted for all templates in
the style sheet, and if you can arrange the processing within
a template so that nodes are only accessed once locally, you
can discard nodes processed by directly called templates from
memory. Making such assertions shouldn't be that hard if the
XPath expressions within the templates use only nodes form
the descendant-or-self axis.
That's precisely what I meant by "a small class of very simple
stylesheets". I came to the conclusion that there are so few real
stylesheets like this that it's not worth the trouble.
Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list