Make Your XML Look How You Want it To with Cascading Style Sheets
Creating an XML document, writing the DTD, and parsing it with a browser are all fine, but how will the document display when you view it? XML is not a language of display. In fact, documents written with XML will have no formatting at all.
So, How Do I View My XML?
The key to viewing XML in a browser is Cascading Style Sheets. Style sheets allow you to define every aspect of your XML document, from the size and color of your text to the background and position of your non-text objects.
Say you have an XML document:
<?xml version=”1.0″ standalone=”yes”>
<!DOCTYPE family [
<!ELEMENT parent (#PCDATA)>
<!ELEMENT child (#PCDATA)>
]>
<family>
<parent>Judy</parent>
<parent>Layard</parent>
<child>Jennifer</child>
<child>Brendan</child>
</family>
Judy Layard Jennifer
Brendan
If you were to view that document in an XML ready browser, such as Internet Explorer, it would display something like this:
(more…)