Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're thinking of XML, not XSLT. XSLT is a language for transforming XML into other structures.


But why would a server send me xml instead of html? From the thread you can see that the servers already serve html so why is there a second way to present that content via xslt?


Because you can do things with XSLT that you can't do with pure HTML

For instance, I can provide an XML file that is a list of widgets, and then I can use to XSLT to give you a table with the values sorted in some way. I can't do that with plain HTML, I'd have to invoke Javascript or something.


When you program a list of widgets you can program it against anything though. Whether its xml or html.


Okay, let's say I have a list of widgets that's in an HTML table. How do I sort the list if I don't want to use Javascript or install some programming language on the web server I'm using (let's say I'm using shared hosting and don't have admin access)? I could sort it by hand, but then I'd need to re-do the whole list if I decided to sort it by another column for some reason. And then if I wanted to add entries, I'd have to insert them by hand into their appropriate place and hope that I don't make a mistake


keeping data orthogonal to presentation


How is html not data?


HTML is data and presentation all in one. The idea with XML + XSLT is that the XML contains the raw, structured data, and one or more XSLTs define how to present it.

It's similar to a modern web app talking to a REST API to get raw data in JSON form and then using that data in some user-friendly rendered web page. Except it's a standard that anyone can use, instead of everyone rolling their own client-side browser code.

Of course, XML is so complicated that it fell out of favour, but that was the idea.


it can be, but because it started as an SGML language (and nowadays who knows what it is) it allows ambiguous structures, plus it doesn't support arbitrary tags, whereas in XML the structure is strict but the tag schema is completely free.


Html does not allow ambigous structures. While it has a more flexible syntax than XML, it always parse to an unambigous structure.


sure, but many browsers support quirks to render malformed HTML, right?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: