RE: [PHP4BETA] Can PHP do XML + XSL = HTML stuff ?

From: Date: Thu, 16 Mar 2000 15:15:59 +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-12237@lists.php.net to get a copy of this message
On 15 Mar 2000, Manuel Lemos wrote: > >This transformation is the only "intelligent" aspect of your whole > >application: It's not very difficult to develop your own XML-format > >for your documents, but it's quite useless without transformation. > > Maybe you didn't notice what I said, but if you generate XHTML (XML > compliant HTML) you don't need to invent another document format and > you don't need to transform it to serve as Web pages because it is already > HTML. But it may be ugly document which is hard to manage, because you mix structure (your own "hi-energy" tags) with presentation classical HTML tags like <table>, <font>, ... > I can see you never tried any of that in practice or else you wouldn't be > say what you are saying. > > You're point of view seems very theoretic. XML/XSL combination only seems > nice when the document transformation you want to do are mere replacements > of data by data. When you want to do more complex things like building > table of contents and cross reference lists you are stuck. It's like try to > do it all with Unix sed program instead of TeX or something that is based > on code not data. You are wrong. XSL(T) all necessary to generate things like ToC, references and so on. I had 10 year experience with TeX and one year with XSLT, and I must say, that in XSLT it is much more simple and elegant to write code which extracts ToC, computes cross-references, generates index and so one. If you do not believe, have a look at XSL stylesheets for DocBook documentation DTD (www.nwalsh.com). > The document was not generated with XSLT. It was generated with a > programmatic engine that does complex things like those above that I > mentioned. HTML output was handled by a module of the engine that takes a > *separate* HTML template file. The <tableofcontents /> tag is handle by > an document module that processes forward references to generate the table > of contents entries. Last time I looked into XSL it didn't seem easy, if > possible at all, to achieve this. Over two last year, XSLT changed rapidly. But now it have quite powerful set of features. Some things are still lacks -- e.g. generating multiple documents by single stylesheet. But this can be overcomed by using XT non-standard (but very usefull) extension. > Another aspect is the time and CPU that it consumed to generate this > document. With PHP 3 it is very slow. To process a 40K XML document it > took 90 seconds. With PHP 4 with Zend optimizer enabled it took 11 > seconds. If I cached the XML documents it still takes 8 seconds in a Linux > based 233MHz Pentium. One a little bit faster machine (333 MHz) XT processor is able to handle 0.5MB input file and apply rather complicated transformations on it in few seconds (5-10). If you use it as servlet for smaller documents, performance is not so bad. And there are upcomming projects, which focus on inteligent caching. For example Cocoon (xml.apache.org/coccon/) has idea, that XSLT stylesheets will be complied to filters in Java .class files. You will get flexibility of XSLT and speed of Java. ----------------------------------------------------------------- Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz

« previous php.version4 (#12237) next »