Date: 09/01/00
- Next message: Derick Rethans: "Re: [PHP-DEV] PHP-sablotron"
- Previous message: Derick Rethans: "Re: [PHP-DEV] XSL Parsing in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
-- Derick Rethans JDI Media SolutionsH.v.Tussenbroekstraat 1 6952 BL Dieren The Netherlands
attached mail follows:
Great,
Lets work on this!
I'm in GMT -5 (Ny, US) but I've actually been switching timezones lately because of all the work I've had to do, now I exist in my own special timezone called the "I'll be awake no matter when you send me an e-mail timezone" :-). I luckily just finished the last of all the major work this morning and slept for the entire day (scary).
Lets open up the conversation on this module right away, I think the first thing to discuss would be the PHP API, this is what I'm envisioning for an API:
1) Hook it into the output buffering support so someone could do something like:
<?php xslt_output_transform("somefile.xsl");
// All output would then be filtered through the style sheet xslt_output_endtransform();
?>
2) Lets also have the basics =-):
int xslt_transform(string xsl_uri, string transform_uri, string result_uri[, array params[, array buffers[, string result]]]) Transform an xslt file
<?php if (xslt_transform($template, $datafile, 'arg:/result', 0, 0, &$result)) { echo "The results of the transformation: $result"; } ?>
int xslt_process(string xsl, string data, string result) Transform data and place it result:
<?php if (xslt_process($xsl, $data, &$result)) { echo "The result of transformation: $result"; } ?>
3) And finally, Lets have that nice little resource management api
resource xslt_create(void) Create a new xslt_processor
<?php $xh = xslt_create();
if (xslt_run($xh, 'test.xsl', 'test')) { $data = xslt_fetch_result ($xh); }
xslt_free($xh); ?>
int xslt_run (resource xslt_handle, string xsl_file, string data_file[, string result[, array params[, array buffers]]]) Parse a xsl file with data_file
<?php
$xh = xslt_create();
$buffers = array(xsl_file => 'test.xsl', data_file => 'test');
$ret = xslt_run($xh, 'arg:/xsl_file', 'arg:/data_file', 'arg:/something', 0, $buffers); if ($ret) { $data = xslt_fetch_result ($xh, 'arg:/something'); } xslt_free($xh); ?>
int xslt_free(resource xslt_handler) Free a xslt_handler
See above examples.
string xslt_error(resource xslt_handle) Get an error string with the last error on the given handler.
<?php $xh = xslt_create(); print xslt_error($xh); xslt_free($xh); ?>
int xslt_log(resource xslt_handle, string filename[, int errorlevel]) Log Sablot messages
<?php $xh = xslt_create(); xslt_log($xh, "/www/logs/error_log");
if (!xslt_run($xh, $xsl, $datafile)) print "Error Logged";
int xslt_register_sax_handlers(resource xslt_handle, array handlers) Register SAX handlers for event based parsing.
<?php function StartDoc () { print "Document Started"; }
function EndDoc () { print "Document Finished"; }
$handlers = array("Document" => array("StartDoc", "EndDoc"));
$xh = xslt_create(); xslt_register_sax_handlers($xh, $handlers);
if (xslt_run($xh, 'test.xsl', 'test')) { $data = xslt_fetch_result ($xh); } xslt_free($xh); ?>
int xslt_set_docInfo_handler(resource xslt_handle, string handler) Set the document information handler.
<?php
function DocumentInfo($content_type, $encoding) { print "This document has a content type of $content_type\n"; print "and an Encoding of $encoding"; }
$handlers = array("Document" => array("StartDoc", "EndDoc"));
$xh = xslt_create(); xslt_register_sax_handlers($xh, $handlers);
if (xslt_run($xh, 'test.xsl', 'test')) { $data = xslt_fetch_result ($xh); } xslt_free($xh); ?>
Comments?
Also I took a look at the source code of the existing sablot code (for integration with PHP), and I don't really like the implementation too much (it works, but its just not my cup of tea). Its seems too hard to extend and work upon, and a little to complex for the task it is achieving and it doesn't have the advanced features, perhaps we might have to write this thing from the ground up either way :-).
Sterling
> Hello, > > Sterling Hughes wrote: > > > > > I'd be willing to write that extension as well, if you don't hear from him > > let me know and we can collaborate on it (maybe get it done in a weekend:-). > > > > If I don't hear from him tomorrow, I'll contact you, so that we can implement > this thing overnight :-) > BTW, in which timezone (GMT+/-) do you live? I'm in GMT+2. >
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Derick Rethans: "Re: [PHP-DEV] PHP-sablotron"
- Previous message: Derick Rethans: "Re: [PHP-DEV] XSL Parsing in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

