WebReference.com - Online Education Resource

Back Contents Next

 

 


Case Study: Data-Driven XSL

Introduction

As business to business commerce and inter-enterprise communication via XML continues to explode, developers will continually be faced with situations where they must convert XML documents from an incoming structure to the structure they use internally. It is this translation requirement that we will use as the premise for this case study.

 

For an example situation where you might want to carry out such translations, consider converting an invoice sent by a field office into a format that is used by central office. The central office computer would have an application, or a web page, that could load the incoming invoice, extract only the information required by central office, and present it in a way that is relevant to the staff at central office, that is, with its data labels changed. Such a utility would save much time and trouble sifting through lots of data just to pick out the snippets of useful information.

 

In this case study we will show how to use ASP to create an XSL file dynamically, and we will data-drive the process using an XML file to define the contents of the XSL file. It is not the intent of this case-study to provide the ultimate translation tool. In fact, this is a simple translation tool that will only map elements to other elements, working within a fixed container/item structure. The mapping process that takes place could be achieved by a simple XSL transformation, which is effectively what we are doing, with the exception that the XSL is being generated on demand.


Meet the Puzzle Pieces

Our example consists of the following pieces:

 

File name

Description

incoming.xml

In-bound XML that needs to be translated

default.asp

Client-side test page that shows the translation at work

interpreter.asp

The ASP page that generates the XSL

interpreter.xml

The definition file for the translation. This is the data that defines the mapping between structures

 

The pieces are related to each other as shown below:

 

 


Back Contents Next
©1999 Wrox Press Limited, US and UK.

http://www.internet.com


Produced by Michael Claßen
All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/xml/resources/books/professionalaspxml/40281001.htm
Created: Jan. 05, 2001
Revised: Jan. 05, 2001