Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can XSLT do everything that CSS can do?

Tags:

xml

xslt

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.

like image 429
Ashwin Avatar asked Nov 30 '11 16:11

Ashwin


2 Answers

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.

like image 157
Jon Hanna Avatar answered Nov 14 '22 22:11

Jon Hanna


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.

like image 33
Boldewyn Avatar answered Nov 14 '22 21:11

Boldewyn