Web Services, Part V: XML and XSLT Programming: The Advantages of XML/XSLT - Doc JavaScript | WebReference

Web Services, Part V: XML and XSLT Programming: The Advantages of XML/XSLT - Doc JavaScript


Web Services, Part V: XML and XSLT Programming

The Advantages of XML/XSLT

The proliferation of XML in many Web applications can be explained, among other factors, by its added information compared with HTML. HTML has become the standard for presenting information on the Web. HTML tags, however, do not contain any information about the data. Look at the following HTML example:

<H1>MyDVD Rental Store</H1>
<H2>Periodical Sales Report</H2> 
<P>Sales report for January, February, and March of 2001</P>

In this example, "MyDVD Rental Store" is a large heading (H1), "Periodical Sales Report" is a smaller heading (H2), and the rest is a paragraph (P). When displayed in a Web browser, you can easily understand these three pieces of information. The size and location of each piece tells you what the author had in mind when writing the HTML page. XML, on the other hand, explicitly defines the data. Here is the same example in XML:

<heading>MyDVD Rental Store on the Web</heading>
<subhead>Periodical Sales Report</subhead>
<description>Sales report for January, February, and 
             March of 2001</description> 

Information in HTML is usually stored in its final form. If you need to present the same Web page in two different ways, you need to create two different HTML pages, each storing the same data. Information in XML, on the other hand, can be presented in a multitude of ways for different target audiences. XML parsers are used to interpret the data.

Another difference between HTML and XML is that unlike HTML, XML provides no formatting information. In HTML, the tag name discloses its format. For example, you expect text within an H1 tag to be larger than text within an H2 tag. XML, on the other hand, has no notation of format whatsoever. You need to use XSL (Extensible Stylesheet Language) or XSLT (XSL Transformation) to display XML information on the Web. XML and XSLT constitute a dynamic and flexible system for handling data and presentation.

Next: How to interpret XML code

https://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: December 31, 2001
Revised: December 31, 2001

URL: https://www.webreference.com/js/column100/2.html