Applying CSS to XML

To apply a stylesheet to an XML document, place the modified following example into the prolog of the XML document.

 <?xml-stylesheet href="style.css" type="text/css"?>

Any XML declaration, such as <?xml version="1.0" encoding="UTF-8"?>, must precede the stylesheet processing instruction.

This applies to XHTML too, if it is served with the correct MIME type: application/xhtml+xml.

A complete example, with an XML declaration and a stylesheet processing instruction:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="rss_style.css" type="text/css"?>
<rss version="2.0">
  <channel>
    <title>My news feed</title>
    <link>http://my.news/</link>
    <description>Latest news</description>
    <language>en-gb</language>
    <copyright>Me</copyright>
    <pubDate>Wed, 06 Sep 2006 00:00:00 GMT</pubDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  </channel>
</rss>

Bibliography


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

Cascading_Style_Sheets/Applying_CSS_to_XML
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultlogic.com. Create an account using LinkedIn to manage and organize your omni-channel knowledge. defaultlogic.com is like a shopping cart for information -- helping you to save, discuss and share.


  Contact Us