Home
Link To Us
Components
Resources










Site Menu

An Overview in Creating an ActiveX DLL for Use with ASP Scripts

Setting up a DSN-Less Database Connection

The Complete FileSystem Object Reference Guide

Search the Web for other ASP Tutorials

A Note From the Author

A Good XML Resource
cover
More Resources




















Top Ranked
Reference Books









An Overview in Combining XML Data With XSL Within ASP
by Derrald Farnsworth-Livingston

Introduction

XML (eXtensible Markup Language) and XSL (Extensible Stylesheet Language) have been created from the necessity of having a structured, defined method of exchanging data. By utilizing XML information that can be pulled from other sources is changing the way we exchange data. Let's say that information is available from another source, and we want access to that data but, do not necessarily want the visitors that are currently on our website to leave our site. Basically, all we want is to integrate some of the information available from the other source with our website. A couple good examples are libraries of free available information or listings of some sort. Information that is formatted so it is in structured XML form makes it easy for us to access the data and then to format this data. XML Data is normally formatted into HTML form using what is known as XSL. XML and XSL are brothers from the same family. XML and XSL are both case sensitive and very structured and unlike HTML require that opening tags be closed in order.

For example this is allowed in HTML:


<center><B><font Face="arial">Howdy!</center></b>

This of course is unacceptable in XSL for several reasons.

1. There is no ending font tag.
2. The "B" for the bold tag is in upper and lower case, XSL would NOT see this as the same tag.
3. The end bold tag needs to precede the end center tag.

The correct form for XSL:


<center><b><font face="arial">Howdy!</font></b></center>

With a little bit of structure an HTML programmer can easily program XSL. We have not yet seen the true power of XSL, however. XSL was created with the purpose of displaying XML data. This data can be retrieved from a static file, a database, or another website. With this dynamically generated websites can be easily formed and manipulated.

We All Need structure

First, we will look at actual XML data. The following is a snippet from an actual XML document that is implemented on this website, this file is named example.xml. If you have Internet Explorer 5.0 and above you can look at the actual XML file by clicking the link.


<?xml version="1.0" encoding="ISO8859-1" ?> 
<tutorial-menu>
   <subject>
   <subject-name>ASP.net</subject-name>
     <topic>
     <topic-name>Introduction</topic-name>
       <tutorial>
   	 <title>ASP and ASP.net</title> 
	 <link>asp.net</link>
	   <update-time></update-time>
	   <sections>
    	       <section>Section 1: Introduction</section>
  	       <link>asp.net/index.aspx</link>
	   </sections>
	   <sections>
    	       <section>Section 2: ASP.net Differences 1</section>
  	       <link>asp.net/aspnetdif.aspx</link>
	   </sections>
	   <sections>
    	       <section>Section 3: ASP.net Differences 2</section>
    	       <link>asp.net/aspnetdif2.aspx</link>
           </sections>
	   <sections>
    	       <section>Section 4: Conclusion</section>
  	       <link>asp.net/aspnetdiffinal.aspx</link>
	   </sections>
	</tutorial>
     </topic>
    </subject>
</tutorial-menu>

This exemplifies how each element is carefully structured. Elements can reside within other elements to create a nesting of information. For instance, the total element "tutorial" contains several children elements such as "title" and "sections" and even "sections" contain sub-elements. This gives the data a very hierarchical type feel. The important thing with this data though is that it is structured. Each beginning element name is encased within <> and each ending within </>. The elements are opened and closed in the correct order and the names are all in the correct cases.


Sections

Section 1: XML Data
Section 2: XSL Power!
Section 3: Same Difference
Section 4: XSL+XML+ASP=HTML

The Bookworm
Search the Tutorial-Web library for books on any topic!
Sponsors

Search Now:
In Association with Amazon.com

Enter your email address to join our mailing list!
We will NOT sell your name to advertisers