spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / authoring / languages / xml / aspnet / chap7 current pageTo page 2To page 3To page 4To page 5To page 6To page 7To page 8To page 9To page 10To page 11To page 12To page 13
[next]

XML for ASP.NET Developers

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

Chapter 7: Transforming XML with XSLT and ASP.NET

In This Chapter:

What Is XSLT?

During the development of the XML specification, the W3C working group realized that for XML to reach its full potential, a method of transforming XML documents into different formats needed to exist. At some time or another, an application that has the capability to work with XML documents will need to display or structure the data in a different format than specified in the document. If the only method for accomplishing this task necessitates programmatically transforming the XML document into the appropriate format by using an XML parser paired with a programming language, the power of having a cross-platform and language-independent XML language would be lost. Some method of transforming XML documents into different formats such as HTML, flat files, Wireless Markup Language (WML), and even other forms of XML needed to be devised so that it could be used on any platform and with any language.

To accommodate this transformation process, Extensible Stylesheet Language Transformations (XSLT) was created. Version 1.0 of the XSLT specification reached recommended status at the W3C in November of 1999 (http://www.w3.org/TR/1999/REC-xslt-19991116) and many XML parsers now provide full XSLT support. The .NET framework provides 100% compliance with the XSLT version 1.0 specification.

What exactly is XSLT useful for and why would you, as an ASP.NET developer, want to learn about it? The answer boils down to the capability of XSLT to transform XML documents into different formats that can be consumed by a variety of devices, including browsers, Personal Digital Assistants (PDAs), Web-enabled phones, and other devices that will appear in the near future.

Transformations can also be useful in situations where an XML document's structure does not match up well with an application that will accept the data within the document. An XML document may contain the appropriate data to be imported into a database, for example, but may not be structured in a way that the application performing the import expects. For example, the application may be better prepared to handle element-based XML documents rather than ones with a lot of attributes, as shown in the following document:

<?xml version="1.0"?>
<root>
  <row id="1" fname="Dan" lname="Wahlin"/>
  <row id="2" fname="Heedy" lname="Wahlin"/>
  <row id="3" fname="Danny" lname="Wahlin"/>
  <row id="4" fname="Jeffery" lname="Wahlin"/>
</root>

Using XSLT, this document can be transformed into a structure that the application is better suited to work with:

<?xml version="1.0"?>
<root>
  <row>
    <id>1</id>
    <fname>Dan</fname>
    <lname>Wahlin</lname>
  </row>
  <row>
    <id>2</id>
    <fname>Heedy</fname>
    <lname>Wahlin</lname>
  </row>
  <row>
    <id>3</id>
    <fname>Danny</fname>
    <lname>Wahlin</lname>
  </row>
  <row>
    <id>4</id>
    <fname>Jeffery</fname>
    <lname>Wahlin</lname>
  </row>
</root>

This chapter teaches you how to perform this type of transformation—as well as many others—by covering the following topics:


home / authoring / languages / xml / aspnet / chap7 current pageTo page 2To page 3To page 4To page 5To page 6To page 7To page 8To page 9To page 10To page 11To page 12To page 13
[next]

© Copyright Pearson Education and


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS · Sending an HTML and Plain Text E-newsletter with ASP.NET, Part 2
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Top 10 Threats to Wireless Security · Poll: UC Uptake on the Rise · Review: Fluke AirCheck Wi-Fi Tester 1.0

Created: April 22, 2002
Revised: April 22, 2002

URL: http://webreference.com/authoring/languages/xml/aspnet/chap7/