Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML and CSS

Displaying XML with CSS


By using CSS (Cascading Style Sheets), you can add display information to an XML document.


Displaying Your XML with CSS?

It is possible to use CSS to format XML documents.

The following example shows how to use a CSS style sheet to format an XML document:

Look at this XML file:CD Catalog

Then look at this style sheet:CSS File

Finally, view:The CD Catalog Formatted with a CSS File

Below is a small part of the XML file. The second line links the XML file to the CSS file:

Empire Burlesque

Bob Dylan

USA

Columbia

10.90

1985

Hide your heart

Bonnie Tyler

UK

CBS Records

9.90

1988

.

.

.

Formatting XML with CSS is not a common approach.

The W3C recommends using XSLT; see the next chapter.