Tuesday, October 31, 2006

Using CSS when displaying an XML document

When you view an XML document in a web-browser you see the XML tree structure.

But it is possible for you to format the display using CSS, but mostly you would be using XSLT to transform the document with.

Here is a small example of how you can use CSS formatting for an XML document.

CSS file
books {
background-color: #000000;
width: 40%;
}
book {
background-color: #FF0000;
display : block;
margin-bottom: 20px;
}
title, price {
display : block;
color: blue;
}


XML document
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/css" href="books.css">
<books>
<book>
<title>Lord of the rings</title>
<price>1.99</price>
</book>
<book>
<title>The davinci mystery</title>
<price>2.99</price>
</book>
</books>

6 comments:

Anonymous said...

In addition to, we purvey discount Cialis dispensary, which is rather noticeable in make use of than other famous Discount Viagra Pharmacy On-line Erectile dysfunction Viagra chemist's shop online drugs.

Anonymous said...

Our polished tolerate body of steep qualified pharmacists will take you Discount Viagra Pharmacy Online, consulting on different health questions.

Anonymous said...

Hello. And Bye.

Anonymous said...

uh... cognitively text.

Anonymous said...

я считаю: спасибо... а82ч

Anonymous said...

In my opinion you commit an error. I suggest it to discuss.