Reputation: 12431
I have no knowledge of XSLT. I was just wondering and have a very simple question.
As CSS is to HTML and XSLT is to XML.
Does it means that XSLT allows developers to do advanced CSS stuff's like position, float, wrap, border-collapse, opacity etc.
Upvotes: 6
Views: 275
Reputation: 113372
XSLT is nothing like CSS.
CSS details the way that a given markup is rendered in a given media (on screen, on paper, to loudspeakers, etc).
XSLT turns one XML document into another document (XML, HTML or plain text, most often XML or HTML).
XSL more generally started with more CSS-like goals, of detailing how an XML document should be presented. This project grew into several different projects with XSL-FO fulfilling this rôle, and XSLT doing the transformations I mentioned above. It was originally designed to help with the XSL-FO stuff (XSLT would turn some XML into XSL-FO that would detail rendering), but now has many uses outside of that, so it made sense to split it off.
CSS can be used directly on XML, so the closest thing to CSS in the XML world, is CSS.
Upvotes: 7
Reputation: 2672
An XSLT file is a transformation template used to present XML using HTML. You can embed inline CSS into your HTML, or you can specify a CSS file to be used to style your resulting HTML, but XSLT will not modify the original XML file.
Upvotes: 1
Reputation: 41569
"As CSS is to HTML and XSLT is to XML."
Not really: XSLT transforms XML into completely different documents or even formats, where as CSS just describes to a browser how to style an HTML document.
You could even use XSLT to generate HTML at CSS if you really wanted to!
Upvotes: 2
Reputation: 82804
You confuse XSLT with XSL-FO. The latter, yes, was once designed to give style to arbitrary XML documents. The idea was this:
any XML -> XSL-FO document -> print / PDF / whatever
^
|
XSLT stylesheet
The name "stylesheet" in XSLT has nothing to do with the term "stylesheet" in CSS.
XSL-FO and CSS were for some time developed side by side, when the CSS working group decided around 2006 to break with the XSL-FO people.
XSLT by itself is best thought of as a programming language to transform one XML format into another or any other text format. It doesn't give visual styles to anything by itself.
Upvotes: 3
Reputation: 3044
XSL-FO (and not XSLT) is to XML what CSS is to HTML. And yes, assuming you have a good XSL-FO processor, you can produce complex formatting.
http://en.wikipedia.org/wiki/XSL_Formatting_Objects
Upvotes: 2
Reputation: 6955
No, XSLT would transform your XML into HTML and then CSS would still do "stuff's like position, float, wrap, border-collapse, opacity etc.". The browser doesn't understand XSLT.
Upvotes: 1