It's actually possible to associate a stylesheet with an XML file, as described at http://www.w3.org/TR/xml-stylesheet/. We can accomplish this by using an "xml-stylesheet" processing instruction to specify the href of a stylesheet to associate with the XML document. So, I took the previous XML document and added the following:

If we use IE7 to view the mytest.xml file, we now see that it has had the defined CSSW styles added to it.

Notice that this does not display the values of the name element's status attribute, which has values of "real" or "imaginary". For browsers that support CSS2 (like Firefox), it's possible to modify our CSS file to display information such as attribute values. To see a demonstration of this, we'll use the mytest2.xml file, which is identical to mytest.xml except for the reference to mytest2.css.

The mytest2.css file is shown below. Notice that we added code such as "name:before" to specify text to come before our name value is displayed and "name:after" to specify text to come after. Notice that we can reference that attribute value via "attr(status)".