Attaching Stylesheets to XML Documents

In HTML, there are three ways of connecting stylesheets to documents: You can use the <STYLE> HTML element to attach an internal or external stylesheet, or you can use the STYLE attribute in HTML elements to style an individual element. In XML, there's really only one way of connecting a stylesheet to an XML document, and that's by using the <?xml-stylesheet?> processing instruction (in fact, <?xml-stylesheet?> is only an agreed-upon convention and does not appear in the XML 1.0 W3C recommendation). To use <?xml-stylesheet?> with CSS stylesheets, you set the type attribute to "text/css" and set the href attribute to the URI of the stylesheet. For example, to attach ch09_02.css to the XML document, I can ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.