Scheme handlers for XSLT in progress.

php.internals

Adam Dickmeiss

22 years ago
Hi, we miss the scheme facility from PHP4's XSLT extension. So, we are making a new one for PHP5's XSL extension, i.e. interfacing libXSLT's xsltRegisterExtModuleFunction. If nobody else have done it/is doing it we'd like to contribute. -- Adam

Christian Stocker

22 years ago
On 10/31/03 11:23 AM, Adam Dickmeiss wrote:
> Hi, > > we miss the scheme facility from PHP4's XSLT extension. So, we are > making a new one for PHP5's XSL extension, i.e. interfacing libXSLT's > xsltRegisterExtModuleFunction. If nobody else have done it/is doing it > we'd like to contribute.
Can't you just use the stream-wrappers provided by PHP5? These are very well supported even in xslt. What's the difference between them and the sablotron way? Besides the different API in PHP userland? chregu

Adam Dickmeiss

22 years ago
Christian Stocker wrote:
> > > On 10/31/03 11:23 AM, Adam Dickmeiss wrote: > >> Hi, >> >> we miss the scheme facility from PHP4's XSLT extension. So, we are >> making a new one for PHP5's XSL extension, i.e. interfacing libXSLT's >> xsltRegisterExtModuleFunction. If nobody else have done it/is doing >> it we'd like to contribute. > > > Can't you just use the stream-wrappers provided by PHP5? These are > very well supported even in xslt. What's the difference between them > and the sablotron way? Besides the different API in PHP userland? > > chregu
Don't know the stream-wrappers, but from what I can see it doesn't do what we need. We want to be called by XSLT (with args etc) when XSLT meets registered elements&NS. So if you want a stylesheet with side effects, say that search in a database, just chaning the stream of XML doesn't help. XSLT must be in control - must have processed the args to the handler A stream approach is "separate" pass. Again, I may have misunderstood something, so we'd really like to know if it can be achived already.. -- Adam

Christian Stocker

22 years ago
Just as an update to this question According to Adam, the stream-wrapper support in ext/xsl seems to have the same possibilities as the schemes support in the former sablotron extension. But he will further look into it and keep us/me updated about the outcome ;) <extremely_shameless_plug> I will talk about stream-wrapper support in ext/dom and ext/xsl in my talk next week at the php conference (and in the slides/examples published afterwards) ;) </extremely_shameless_plug> chregu On 10/31/03 12:20 PM, Adam Dickmeiss wrote:
> Christian Stocker wrote: > >> >> >> On 10/31/03 11:23 AM, Adam Dickmeiss wrote: >> >>> Hi, >>> >>> we miss the scheme facility from PHP4's XSLT extension. So, we are >>> making a new one for PHP5's XSL extension, i.e. interfacing libXSLT's >>> xsltRegisterExtModuleFunction. If nobody else have done it/is doing >>> it we'd like to contribute. >> >> >> >> Can't you just use the stream-wrappers provided by PHP5? These are >> very well supported even in xslt. What's the difference between them >> and the sablotron way? Besides the different API in PHP userland? >> >> chregu > > > Don't know the stream-wrappers, but from what I can see it doesn't do > what we need. We want to be called by XSLT (with args etc) when XSLT > meets registered elements&NS. So if you want a stylesheet with side > effects, say that search in a database, just chaning the stream of XML > doesn't help. XSLT must be in control - must have processed the args to > the handler A stream approach is "separate" pass. Again, I may have > misunderstood something, so we'd really like to know if it can be > achived already.. > > -- Adam > >> >> >
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB

Adam Dickmeiss

22 years ago
Christian Stocker wrote:
> Just as an update to this question > > According to Adam, the stream-wrapper support in ext/xsl seems to have > the same possibilities as the schemes support in the former sablotron > extension. But he will further look into it and keep us/me updated > about the outcome ;) >
I've wrapped made a stream class with methods stream_open, stream_read, stream_tell, stream_eof, stream_seek, stream_stat, stream_close. When I use this handler from within XSLT I get : *Warning*: xsltprocessor::importStylesheet() [function.importStylesheet <http://peanut:8080/tkl5/function.importStylesheet>]: tkl_file_stream::url_stat is not implemented! in */home/adam/proj/httpd/htdocs/tkl5/xsl-ex2.php* on line *70* What's url_stat supposed to do? Prototype? -- Adam

Adam Dickmeiss

22 years ago
Adam Dickmeiss wrote:
> Christian Stocker wrote: > >> Just as an update to this question >> >> According to Adam, the stream-wrapper support in ext/xsl seems to >> have the same possibilities as the schemes support in the former >> sablotron extension. But he will further look into it and keep us/me >> updated about the outcome ;) >> > I've wrapped made a stream class with methods stream_open, > stream_read, stream_tell, stream_eof, stream_seek, stream_stat, > stream_close. When I use this handler from within XSLT I get : > *Warning*: xsltprocessor::importStylesheet() > [function.importStylesheet > <http://peanut:8080/tkl5/function.importStylesheet>]: > tkl_file_stream::url_stat is not implemented! in > */home/adam/proj/httpd/htdocs/tkl5/xsl-ex2.php* on line *70* > What's url_stat supposed to do? Prototype?
Looking at the PHP source, I decided to use: function url_stat ($path) { return array(); } with satisfactory results, so far. -- Adam

Christian Stocker

22 years ago
On 11/4/03 3:42 PM, Adam Dickmeiss wrote:
> Adam Dickmeiss wrote: > >> Christian Stocker wrote: >> >>> Just as an update to this question >>> >>> According to Adam, the stream-wrapper support in ext/xsl seems to >>> have the same possibilities as the schemes support in the former >>> sablotron extension. But he will further look into it and keep us/me >>> updated about the outcome ;) >>> >> I've wrapped made a stream class with methods stream_open, >> stream_read, stream_tell, stream_eof, stream_seek, stream_stat, >> stream_close. When I use this handler from within XSLT I get : >> *Warning*: xsltprocessor::importStylesheet() >> [function.importStylesheet >> <http://peanut:8080/tkl5/function.importStylesheet>]: >> tkl_file_stream::url_stat is not implemented! in >> */home/adam/proj/httpd/htdocs/tkl5/xsl-ex2.php* on line *70* >> What's url_stat supposed to do? Prototype? > > > Looking at the PHP source, I decided to use: > function url_stat ($path) > { > return array(); > } > with satisfactory results, so far.
Yep, it's supposed to have the same format as the array returned by fstat(). But an empty array is ok ;) chregu
> > -- Adam > > > > >> >> -- Adam >> >
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB