Separating Content from Presentation

When most Web programming was done on a small scale by individuals, the problems arising from mixing content and presentation existed but weren’t a major problem for small-scale HTML users. If you had to make many individual changes, the total number was unlikely to be enormous.

One of the disadvantages of HTML for large projects is that content and presentation are entangled. An h1 tag indicates that the contained text is a heading, but, depending on the way the browser is configured, it also indicates something about how the text is to be displayed. Increasingly, HTML documents separate presentation from content by using Cascading Style Sheets (CSS).

In XML, by contrast, typically a document describes only the logical structure of the data:

<book> 
<title>The Bible</title> 
<TestamentTitle>The Old Testament</TestamentTitle> 
<TestamentTitle>The New Testament</TestamentTitle> 
</book> 

You might expect the text content of the title and TestamentTitle elements in the preceding code to be displayed as headings, but the XML document contains no information about exactly how they should be presented. Typically, an XML document is styled using CSS style sheets or using XSLT.

Note

For historical reasons, a CSS style sheet is two words and an XSLT stylesheet is one word.



..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset