tags:

views:

46

answers:

2

Hi, I am new for the xml. I just want to know why xml needs styles. is this style means css ? and where it should impact ?

A: 

This is a great place to start.

Basically, Style Sheets (similar to CSS) can be used on XML documents (by using XSL aka "Style Sheets for XML") to display them in a "HTML Look and Feel".

It's done this way so that there is a clean separation between the content of a HTML page (which is provided as XML) and the actual view/display of it in the users' browser.

This way, different XSL Style Sheets can be used on the same content (i.e. XML).

For example to display the XML in a iPhone or on a desktop monitor there can be two XSL's, one for iPhone and one for the desktop monitor.

Zabba
CSS can be used on XML documents. XSL can be used on XML documents. They are separate things. You don't use XSL to apply CSS. And wow, that tutorial is really badly written, even for W3Schools standards (which are generally rock bottom).
David Dorward
Corrected, thanks. Would be nice if you would post some links to a better XSL tutorial for a beginner.
Zabba
Style sheets is a catch all term and includes CSS (which isn't just similar to CSS) and XSL (which is not similar to CSS). I couldn't point to a good XSL tutorial off the top of my head.
David Dorward
ok ok..guys..relax. I just wanted to know why its (style to xml) use. means CSS only needs when we generates html from xml. basically useful when transform xml to html , right? please correct me.
Lalit
@Lalit xsl can be applied on xml to generate html or any other format (plain text or your own format).
Amarghosh
@Lalit — No. CSS can be applied directly on arbitrary XML.
David Dorward
but why then its need then, is this mean that If i apply the css to the xml , then it generate accordingly view in browser?
Lalit
XSL is used most often to turn a document written in an XML based language into a different format. Different formats have different advantages (e.g. PDF is pretty reliable for an exact print layout, HTML has semantic information that lots of clients can make use of (e.g. it has data useful for search engines, screen readers, and the ability to include hyperlinks).
David Dorward
A: 

Take a look at the following resource for XSL and XSLT:

http://www.w3schools.com/xsl/

From the tutorial:

XSL = Style Sheets for XML

XML does not use predefined tags (we can use any tag-names we like), and therefore the meaning of each tag is not well understood.

A tag could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.

XSL describes how the XML document should be displayed!

kbrimington