Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another benefits of xml? post

Status
Not open for further replies.

stasJohn

Programmer
May 6, 2004
155
0
0
US
I've dabbled a little bit with xml/xslt. XML is easy, no problems there. XSLT is a little weird, but I'm learning.

Anywho, my question is this. To me, XSLT is similar to an html file with embedded php in it.

What are the benefits of an XSLT file over an html file with embedded php (or a jsp page or asp)? They both yeild the same results. I feel like using XSLT adds an extra step to the whole process, since you have to capture the XSLT output and then send it to a web browser.

Thanks for the input!

ps
Any good examples/tutorials out there about using xml/xslt to drive a website using php or jsp. I don't know asp? thanks again.
 
Basically, XSLT allows you to abstract your data transformation a level away from your data processing/app logic.

So, in your example, PHP can continue to deal with application flow/control and data requisition whilst XSLT can be used on the final data (XML) to decide how everything will look.



 
One Xslt many Programming Languages!

I will not be able to use your php page from my C# Proggy, but i will be able to use your xslt. So if you create an xslt you can use it in almost every Programming Language! What if you decided to change your website from php to jsp, or asp,..... your xslt will still work your php solution, you would have to recode!

Just one reason,....

 
[continued] So, the benefits generally are that your program logic isn't intertwined with the way you display your data on the page.

For small apps, its not really a problem, but when it comes to altering a table or layout or an entire column or something, you will have to change the way your PHP works. With XSLT, you can alter the display of the data without altering the way your code works.

Plus, XSLT is just a really neat way of dealing with XML data :)

 
[cont again]

Interoperability. I can take XML from one company, and transform the data I want to see from that data.

Not only does XLST work on web pages, but it can transform the data into practically any format. So, for example, I could potentially have a list of prices delivered as XML from, say, ebay, and transform the XML using XSLT into an Excel document. Or a PDF using FOP (a variant of XSLT). Or another XML document. Or plain text. Or HTML.

Man, theres a million reasons to use XSLT :)



 
Man you sound like you would get paid for every new user using xml and xslt :D

 
thanks for the input. I think I'm starting to see. I guess once I start working with it, it'll make more sense. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top