[wp-hackers] Shared Knowledge for Developers

Stephane Daury wordpress at tekartist.org
Thu Sep 6 00:27:23 GMT 2007


Abandoning the code might not have been a bad idea. ;)

I've been following XSL since its inception as a draft, and I have to  
admit I've never found it to be the best solution to my problems in  
dynamic environments (see exception below). I tried quite a few times  
when it was a legitimate candidate, and It definitely has its  
strength, but I'm not a big fan. One of the reason is that one of its  
supposed applications is to serve as a *middleware* language between  
backend and frontend coders, but I've never found any designers who  
could figure out XSLT anymore than they could figure out PHP. And if  
they do/did, they just use(d) PHP directly (since as you mentioned,  
it is a templating engine itself). :)

This this date, I've only ever used it once in a long-term production  
environment (to convert custom embedable XML tags to a dynamic output  
in a CMS environment. Where it makes the most sense is in processes  
like docbook->HTML (etc) batch processes (and PHP isn't always the  
best solution for that, though not a bad one).

Stephane



On Sep 05, 2007, at 20:01, Jacob Santos wrote:

> Sweet! Thanks.
>
> That would have worked great, but it is too bad I've abandoned the  
> code or I would probably have tried this method.
>
> Jacob Santos
>
> Stephane Daury wrote:
>> On Sep 05, 2007, at 13:10, Computer Guru wrote:
>>
>>>> PHP 5 XSLT doesn't seem to like for PHP in the XML file, and if  
>>>> you can
>>>> fix this problem, then please I would like to see the code.
>>
>>
>> Note the code below is assuming you mean the PHP5/libxslt-based  
>> XSL features (not the older Sablotron-based ones)
>> http://www.php.net/manual/en/ref.xsl.php
>>
>> That's because the XML is not pre-processed when loaded through  
>> DOMDocument (before being forked off to XSLTProcessor).
>>
>> The only way to process an XML file with PHP in it (that I know  
>> of) is to use DOMDocument->loadXML() coupled with a  
>> file_get_contents() call on a URL, instead of DOMDocument->load()  
>> on a local file. That forces it to pass though httpd+php and your  
>> XSLT process therefore only gets the rendered output.
>>
>> This said, it's obviously not the best performance, but I've used  
>> it once in the past and coupled with caching, it's not bad at all  
>> when you benchmark it against a similar DB query or so.
>>
>> Stephane
>>
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list