>> - why there is code to execute stylesheet in ElemTemplateElem.execute method >> and also in TransformerImpl, which and when is used
>That's a good question, but I don't know the answer. It looks like the code in >TransformerImpl is used to match the initial template for stylesheet processing and >also for template matching for xsl:apply-imports, but I have no idea why the code is >organized that way. I suspect that's mostly a historical artifact -- how the code evolved over time -- more than a principled design decision. There are a number of places where we had the choice of building additional layers of interpretation/compilation or of inlining some of that code, and decisions were driven by a mixture of what else had been written at that point (which may have changed later), whether we thought we might need/want to make localized tweaks for performance reasons, and so on.