What I’d like to do is, from inside a (.Net) XSLT transformation, I will invoke a template that will return some XML, but the returned XML may itself include XSLT instructions to be processed. This process should operate recursively until there is no XSLT left, and then the output will be put into the result tree.
It may be that each “template” actually has to be a separate file, but I’d like to have the context (parameters, variables, and context nodes etc) maintained throughout the whole process, so just having recursive invocations of the Transform() method seems like it will not suffice.
A somewhat related question: say I call an extension function from inside a template. Is there a way to invoke a template from inside the extension function? It seems that the documentation on extension objects is extremely light – it tells you how to call it but doesn’t document any parts of the xslt infrastructure I can interact with.
Apologies for not providing a decent concrete example but I’m in a research phase at the moment so it’s all a bit abstract.
Andy
If the result of a transformation has nodes in the
http://www.w3.org/1999/XSL/Transformnamespace then you are dynamically generating XSLT, and to execute the generated XSLT you need to start/invoke a new transformation, it cannot be done from XSLT (at least not without an extension function).You are talking about templates a lot, but XSLT operates with modules, templates is just one of the types of declarations a module can have. Why do you want parameters, variables, and context nodes to be mantained? After a transformation is done this information is no longer needed.
No, you cannot invoke a template from an extension function.