Re: [PHP4BETA] Can PHP do XML + XSL = HTML stuff ?
| From: | Manuel Lemos | Date: | Sun, 12 Mar 2000 03:45:15 +0000 |
| Subject: | Re: [PHP4BETA] Can PHP do XML + XSL = HTML stuff ? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11931@lists.php.net to get a copy of this message | ||
Hello Lukasz,
On 11-Mar-00 23:06:17, you wrote:
>Let's say I have to input files : foo.xml and foo.xsl. Basically, what I want
>to do is to parse the xml, apply the stylesheets from xsl and have on the
>output a html file. A'im afraid bundled expat lib can't handle such things...
>What's the best way to do this using PHP ?
expat is just a parser library that lets you set callbacks to handle the
XML elements as they are found. It has been said that PHP 4 will feature DOM
support but I don't know what it consists.
I have a generic XML parser class class done in PHP based on PHP expat XML
support. It is able to extract the whole structure of elements of a XML
file and build a flat array with them. This makes XML much easier to
transform into anything that you care.
http://phpclasses.UpperDesign.com/browse.html/package/4
I don't have real experience with XSL, but last time I looked it seemed
that you have to go around in circles with expression matching programming
that reminds me a lot of sed (that Unix stream editing language that is
powerful but really annoying). I don't know if that is what you are
looking for but I didn't like the idea.
Another point is it is really awkward to generate XML dynamically when what
you really want is to output HTML. So, why bother to put your server under
a heavy load (that is what you can expect from runtime XML processing) to
present HTML that you could generate directly?
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--