Latest web development tutorials


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

Use CSS to display your XML?

Use CSS to format an XML document is possible.

The following are examples of how to use CSS style sheets to format XML documents:

Look at this XML file: the CD directory

Then look at this style sheet: the CSS file

Finally, see: Use CSS file formatted CD catalog

Here is a small part of the XML file. The second line of the XML file is linked to the CSS file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>
<TITLE>Empire Burlesque</TITLE>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>

Formatting XML with CSS is not a commonly used method.

W3C recommend using XSLT, see the next chapter.