Re: [xsl] Is it possible to store XSLT code fragments as data and then dynamically evaluate those code fragments?

Subject: Re: [xsl] Is it possible to store XSLT code fragments as data and then dynamically evaluate those code fragments?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Jun 2019 11:49:47 -0000
Hi,

I have done this sort of thing successfully in Saxon using the
transform() function. The pattern is not exactly the same - you take
your list of XPaths (runtime parameter or source), stitch them
together into an XSLT, and execute. It is a useful pattern for all
kinds of heuristics, not only dynamic path evaluation.

I also agree with Graydon, however, that if retrieval is your only
purpose, producing and executing XQuery might make more sense than
producing XSLT. (Trivial in this case.) Either way, XSLT is awesome at
code generation (which might be the same as dynamic function calls
seen through the other end of the spy glass?) -- and always has been.
This is also bread and butter in XSLT 1.0, writing an interim
serialization to the file system as necessary.

Cheers, Wendell

Current Thread