Jump to content

xlst vs php


primefalcon

Recommended Posts

I think XSLT is better but I am not tooo sure!

Link to comment
Share on other sites

Comparing XSLT to PHP is like comparing a horse to a person.Both are alive, both have will, both can move and reproduce. The horse is only useful to a man for transportation (either of cargo or men), but does a better job at it then a person. A person is good for transportation too, and it's also good at many other stuff, one of which is riding the horse (if (s)he has the skills for it), but is slower then a horse and can carry less cargo (and a person? One or two if we're talking a strong man carring lighter people). But the unique ability of the person to ride the horse makes it an important part in the process and it means a man and a horse can and should work together.In the same way, both XSLT and PHP can read XML and both can reproduce... a new XML from it (or not from it, in the case of PHP). While XSLT can only turn XML into another XML based file or plain text, it does it pretty well, easily enough (once you learn it's few principles) and (most importantly) portably. At the same time, PHP can do the same things, but the code requred is almost always a lot more complex and hard to read. It can do many other stuff as well, among which is executing XSLT transformations and processing their results. In the end, it's better to use both languages for what they are good for - PHP for executing XSLT with additional parameters (if any are requred) as well as manipulating the result and XSLT to create the result for PHP with the parameters passed (if any).This also follows the principle of using the least powerful language for what you need, hence that language should be better at what it's supposed to do. If the only output you need from an XML file is plain text, using PHP's DOM functions would be best and if you need a complete page, execute XSLT with PHP and print/echo the result or change whatever XSLT won't be able to (though with parameters, there's almost nothing you can't do with XSLT).

Link to comment
Share on other sites

Plus in XSLT you download the whole XML anf XSL file and then show the stuff. But if you use PHP then only the required info is echo'd or sent!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...