[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Dynamic pipelining in XSLT 2.0 w/ Saxon extensions

Subject: Re: 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
Re:  Dynamic pipelining in XSLT 2.0 w/ Saxon extensions
Hey Wendell :)

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;

namespace Xameleon {

public class XsltCompiledHashtable {

        private Processor processor = new Processor();
        private Hashtable results;

        public XsltCompiledHashtable() {
            this.results = new Hashtable();
        }
        public XsltCompiledHashtable(Hashtable table) {
            this.results = table;
        }

public XsltTransformer GetTransformer(string href, Uri baseUri) {

            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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.