When I had decided to redevelop my website using PHP4's XSLT functions as 
the templating system (as opposed to Smarty, phplib etc.), I looked at 
PHP4's two alternatives:

1. XML (Expat) + XSL (Sablotron)
2. DOMXML (libxml2 & libxslt)

At the time there were early signs that PHP5's XML/XSLT support would be 
based on libxml2/libxslt (and that is what finally happened).

That made me decide to use DOMXML.

If the current situation remains, when my hosting company finally replace 
PHP4 with PHP5 (not in the near future, I hope!) my site will break due to 
PHP5 not supporting the DOMXML function. This will be repeated for all 
other sites that use this function.

On the contrary, under PHP5, PHP4 scripts based on the XML function will 
work, even though the underlying library has changed!

There should also be a transitional solution for DOMXML users rather than 
the present lack of either forwards compatibility in PHP4 or backwards 
compatibility in PHP5.

To workaround this problem there are at least two alternatives:

1. A PHP script could be created to check the running PHP version and if 
it's >=PHP5 then translate the PHP4 DOMXML function calls to their 
equivalent PHP5 DOM function calls. This would allow existing PHP4 scripts 
to work under PHP5 and ease the transition to replacement scripts based on 
PHP5's DOM's XML & XSLT  functions.

2. Have a development system that supports both PHP4 & PHP5 and develop 
PHP5 DOM based replacement scripts. Then work very closely with the hosting 
company so that at the same time they replace PHP4 with PHP5, the new PHP5 
scripts replace the PHP4 ones (or use a PHP script to check the version and 
then point to either the PHP4 or PHP5 scripts).

Neither is a good solution nor are they built-in solutions, therefore they 
will be repeated, perhaps with slight variations, by all(?) DOMXML users 
around the world.

A much better approach would be for PHP5 to include backwards compatibility 
for the DOMXML function (at least for the most common function calls eg. 
domxml_open_file, domxml_xslt_stylesheet_file, result_dump_mem, etc.), as 
PHP5 does with practically every other PHP4 function.

When PHP5 reaches version 5.3 or 5.4, the DOMXML support could be removed 
to avoid bloat (this has been done before with other functions). By then 
people would've had sufficient time to replace their old DOMXML code.

Under PHP4 it was easy for me to create some initial scripts to test it's 
two XSLT related functions, on the same local web server software running a 
single PHP interpreter.

It would be as easy to develop DOM based replacement scripts for DOMXML 
ones if both functions worked under PHP5, rather than the current situation 
of DOMXML only working with PHP4 & DOM only working in PHP5.

Sorry if this post is a bit long but I hope you find my suggestion is 
reasonable?

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to