May 27, 2021 18:00 XML

Table of contents

Use CSS to display XML

In this section, we'll show you anyone who displays XML through CSS.

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

Show your XML using CSS?

It is possible to format XML documents using CSS.

The following example is about how to format an XML document using a CSS style sheet:

Look at this XML file: CD directory

Then look at this style sheet: CSS file

Finally, check out: Cd directories formatted with CSS files

Below is a small part of the XML file. The second line links the XML file 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 common method.

The W3C recommends XSLT, see the next chapter.

Related tutorials

CSS tutorial