420
Chapter 15: Displaying XML data
Adobe® Dreamweaver® CS3 includes tools that let you display Extensible Markup Language (XML) data on your web
page and create pages that perform Extensible Stylesheet Language Transformations (XSLT) on either the client or
the server.
About XML and XSLT
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 (schema). 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 shows the basic structure of an XML file:
<?xml version=“1.0”>
<mybooks>
<book bookid=“1”>
<pubdate>03/01/2004</pubdate>
<title>Displaying XML Data with Adobe Dreamweaver</title>
<author>Charles Brown</author>
</book>
<book bookid=“2”>
<pubdate>04/08/2004</pubdate>
<title>Understanding XML</title>
<author>John Thompson</author>
</book>
</mybooks>
In this example, each parent
<book>
tag contains three child tags:
<pubdate>
,
<title>
, and
<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, 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. Once you
have an XML schema, you can use the 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 you’ve 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.
September 4, 2007