Re: Sabloton XSL??
| From: | Lars Torben Wilson | Date: | Thu, 12 Oct 2000 23:52:38 +0000 |
| Subject: | Re: Sabloton XSL?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19918@lists.php.net to get a copy of this message | ||
Matt Dunford writes:
> Can anyone point me in the direction of some info on the new Sabloton
> extension in php 4.0.3? I'm unable to find anything on the web nor on
> php.net.
>
> Here's the configure option
> --with-sablot[=DIR] Include Sablotron support
Go to http://www.gingerall.com and download the binaries for
Linux and
install them (I put mine under /usr/local; PHP config will by default
look there and under /usr, so you won't need to use the -DIR).
When you compile PHP, though, you'll need to enable the zlib extension
as well--and you'll need some way to force the sablot extension to
link against the proper libxmltok and libxmlparse. For me, this
involved a hack of ext/sablot/config.m4 to add the libraries, but I
cannot profess to any deep understanding of the PHP build system at
this level so someone else should guide you on this one. I don't want
to disseminate screwy information. :)
I've been messing with this for the last few days, and the only
information I could find I have had to cobble together from the
mailing list archives and the source. There are at least a couple of
different ways to use it: one, you can use it as a full-on output
transformation, basically meaning that any output from PHP is run
through the XSLT transformation:
function using_output_transformer($xml_filename, $xsl_filename) {
xslt_output_begintransform($xsl_filename);
readfile($xml_filename);
/* You could also echo or whatever your XML data here... */
xslt_output_endtransform();
}
Another way is to use it more like the expat XML extension:
function using_xslt_run($xml_filename, $xsl_filename) {
if (!$xslt = xslt_create()) {
echo "Failed to create Sablotron parser.<br>\n";
return false;
} else {
echo "Created Sablotron parser with handle ID '$xslt'<br>\n";
}
if (xslt_run($xslt, $xsl_filename, $xml_filename)) {
echo "xslt_run() appears to have succeeded<br>\n";
} else {
echo "xslt_run() failed<br>\n";
return false;
}
echo xslt_fetch_result($xslt);
xslt_free($xslt);
return true;
}
Hope this at least gets you started.
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+