Learn about using XML and XSL with web pages
Extensible Markup Language (XML) is a language that lets you structure information. Like HTML, XML lets you structure your information using tags, but XML tags are not predefined as HTML tags are. Instead, XML lets you create tags that best define your data structure. Tags are nested within others to create a schema of parent and child tags. Like most HTML tags, all tags in an XML schema have an opening and closing tag.
The following example illustrates the basic structure of an XML file:
<title>Displaying XML Data with Macromedia Dreamweaver</title>
In this example, each parent
<book> tag contains three child tags:
<author>. But each
<book> tag is also a child tag of the
<mybooks> tag, which is one level higher in the schema. You can name and structure XML tags in any way you like, provided that you nest tags accordingly within others, and assign each opening tag a corresponding closing tag.
XML documents do not contain any formatting--they are simply containers of structured information. (Youll notice that the sample code contains no font, table, or heading tags.) Once you have an XML schema, you can use Extensible Stylesheet Language (XSL) to display the information. In the way that Cascading Style Sheets (CSS) let you format HTML, XSL lets you format XML data. You can define styles, page elements, layout, and so forth in an XSL file and attach it to an XML file so that when a user views the XML data in a browser, the data is formatted according to whatever youve defined in the XSL file. The content (the XML data) and presentation (defined by the XSL file) are entirely separate, providing you with greater control over how your information appears on a web page. In essence, XSL is a presentation technology for XML, where the primary output is an HTML page.
Extensible Stylesheet Language Transformations (XSLT) is a subset language of XSL that actually lets you display XML data on a web page, and "transform" it, along with XSL styles, into readable, styled information in the form of HTML. You can use Dreamweaver to create XSLT pages that let you perform XSL transformations using an application server or a browser. When you perform a server-side XSL transformation, the server does the work of transforming the XML and XSL, and displaying it on the page. When you perform a client-side transformation, a browser (such as Internet Explorer) does the work.
The approach you ultimately take (server-side transformations versus client-side transformations) depends on what you are trying to achieve as an end result, the technologies available to you, the level of access you have to XML source files, and other factors. Both approaches have their own benefits and limitations. For example server-side transformations work in all browsers while client-side transformations are restricted to modern browsers only (Internet Explorer 6, Netscape 8, Mozilla 1.8, and Firefox 1.0.2). Server-side transformations let you display XML data dynamically from your own server or from anywhere else on the web, while client-side transformations must use XML data that is locally hosted on your own web server. Lastly, server-side transformations require that you deploy your pages to a configured application server, while client-side transformations only require access to a web server.
This tutorial takes you through the steps of creating an XSLT page and performing a client-side transformation (mainly because the client-side workflow is much easier to execute, and doesnt require the use of an application server.) For more information about other ways to deploy XSLT pages, see Learn about other deployment options.