Subject: Re: [xsl] Dynamic pipelining in XSLT 2.0 w/ Saxon extensions From: "M. David Peterson" <m.david@xxxxxxxxxxxxx> Date: Mon, 18 Jun 2007 23:25:10 -0600 |
On Mon, 18 Jun 2007 15:19:54 -0600, Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote:
* This runs (tested under the current Saxon 8.9), but how will it scale? In particular, Mike Kay may be able to say whether compiled stylesheets are be cached when this is run over a set of documents. If not, wouldn't compiling each stylesheet anew for each input document be an impediment?
I'll wait to hear from Dr. Kay on this matter before writing any more code, but in theory one could easily use an extension function to implement each chain of the pipeline, using a Hashtable to store compiled transformation file if it's the first time it's been accessed. For example (using Saxon on .NET/C# as the sample, those this easily translates to Java as well),
[@http://extf.googlecode.com/svn/trunk/Xameleon/Function/XsltCompiledHashtabl e.cs] using System; using Saxon.Api; using System.Collections;
private Processor processor = new Processor(); private Hashtable results;
public XsltCompiledHashtable() { this.results = new Hashtable(); } public XsltCompiledHashtable(Hashtable table) { this.results = table; }
foreach (DictionaryEntry entry in results) { string uri = (string)entry.Key; if (uri == href) { return (XsltTransformer)results[uri]; } }
XsltTransformer transformer = processor.NewXsltCompiler().Compile(new Uri(href)).Load(); results[href] = transformer; return transformer; } } }
While the focus is different, I've continued to work on the server-side portion of the Atomictalk project over the last few weeks, developing an XML sequence syntax to perform various operations based on user input passed to a URI endpoint. (e.g. [1,3,5] represent the operation sequence that outputs the result of [2,4,6]) I've been thinking about this same issue as of late, wondering how I might best go about loading transformation files dynamically from the PI of a given input file, so If it turns out this is a good and proper approach to solving this particular issue, I will extend this code to be utilized via an extension function for purpose of testing.
[1] http://personplacething-info.googlecode.com/svn/trunk/public_web/service/prox y/service.op [2] http://personplacething.info/service/proxy/?debug=true&return-xml-from-uri=ht tp://www.w3.org/People/Berners-Lee/card&return-doc-id=i
[3] http://personplacething-info.googlecode.com/svn/trunk/public_web/service/semw eb/service.op [4] http://personplacething.info/service/semweb/?debug=true&foaf-uri=http://www.w 3.org/People/Berners-Lee/card
[5] http://personplacething-info.googlecode.com/svn/trunk/public_web/service/redi rect/service.op [6] http://personplacething.info/service/redirect/?redirect=http://s3.amazonaws.c om/m.david/test-index.xml&status-code=303
-- /M:D
M. David Peterson http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | http://dev.aol.com/blog/3155
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dynamic pipelining in XSLT 2., Wendell Piez | Thread | Re: [xsl] Dynamic pipelining in XSL, Florent Georges |
[xsl] Dynamic pipelining in XSLT 2., Wendell Piez | Date | [xsl] grouping nesting items, inclu, Don Smith |
Month |