Subject: Re: API for extension functions (was HTML forms with XSLT slideshow question) From: James Clark <jjc@xxxxxxxxxx> Date: Mon, 27 Sep 1999 17:49:05 +0700 |
Kay Michael wrote: > > > > - how to provide context information (this has been my main reservation > in > > > adopting xt's style of interface: it's fine for "pure" > > functions but doesn't > > > extend easily to functions that use context, e.g. the > > current node or the system id of the containing stylesheet node. > > > > Why can't you extend it by defining an interface along the lines of: > > > > interface XPathContext { > > Node getCurrentNode(); > > String getStylesheetSystemId(); > > ... > > } > > > > ? > > > > Then if the first argument of the Java function is of type > > XPathContext, > > the XSLT processor will automatically pass the Java function an > > additional argument of type XPathContext representing the current > > context. > > > That's certainly one possibility. Another (the one I was planning) is to say > that if the class containing the extension function implements Contextual, > then the method setContext(XPathContext) will be called before the function > itself is called. That might be OK in a single-threaded environment, but doesn't seem a good solution in a multi-threaded environment. It also seems unsatisfactory for static methods. Another issue is providing access to information defined by non-XSL top-level elements (eg an extension function that used top-level elements in a similar way to format-number() or key()). James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: API for extension functions (wa, Kay Michael | Thread | XSL-Editors, heiko . grussbach |
RE: API for extension functions (wa, Kay Michael | Date | Extension functions in XT (was Re: , Edd Dumbill |
Month |