BizTalk Utilities CV ,   Jobs ,   Code library  
 
 
Page 2 of 4

 

Previous Page Table Of Contents Next Page
Table of Contents

• Introduction
• Meet the Puzzle Pieces
  The Data
•  Generating the XSL
•  The Test Page
•  How it Works
•  Summary

The Data

This case-study uses three XML files:

  • The incoming data (input,aka: "incoming.xml")
  • The translation definition file (process, aka: "interpreter.xml")
  • The translated data (output, seen from the test page)

Let's look at the structure of each of these:
Input XML

<?xml version='1.0'?>
<shipments>
<shipment>
<waybill>123WXZ99</waybill>
<carrier>Fedex</carrier>
<shipDate>20000110</shipDate>
<boxes>3</boxes>
</shipment>
<shipment>
<waybill>79843A</waybill>
<carrier>UPS</carrier>
<shipDate>20000110</shipDate>
<boxes>2</boxes>
</shipment>
<shipment>
<waybill>XXX12A</waybill>
<carrier>Fedex</carrier>
<shipDate>20000110</shipDate>
<boxes>8</boxes>
</shipment>
</shipments>

Output XML

<?xml version='1.0'?>
<shipments>
<shipment>
<waybill>123WXZ99</waybill>
<shippedby>Fedex</shippedby>
<shipped>20000110</shipped>
<numberOfBoxes>3</numberOfBoxes>
</shipment>
<shipment>
<waybill>79843A</waybill>
<shippedby>UPS</shippedby>
<shipped>20000110</shipped>
<numberOfBoxes>2</numberOfBoxes>
</shipment>
<shipment>
<waybill>XXX12A</waybill>
<shippedby>Fedex</shippedby>
<shipped>20000110</shipped>
<numberOfBoxes>8</numberOfBoxes>
</shipment>
</shipments>

The Translation Process
As you can see, the input and desired output files have a similar structure, but there are three differences:

q "carrier" becomes "shippedby"
q "shipDate" becomes "shipped"
q "boxes" becomes "numberOfBoxes"

The required element mapping is defined in the following XML file:

<?xml version='1.0'?>
<shipments>
<shipment>
<xlat>
<in name="waybill"/>
<out name="waybill"/>
</xlat>
<xlat>
<in name="carrier"/>
<out name="shippedby"/>
</xlat>
<xlat>
<in name="shipDate"/>
<out name="shipped"/>
</xlat>
<xlat>
<in name="boxes"/>
<out name="numberOfBoxes"/>
</xlat>
</shipment>
</shipments>

As you can see, each <xlat> element contains an input element name and an output element name. This is the mapping we will use when we build our XSL. Note that the first of the <xlat> elements does something rather pointless - replacing "waybill" with "waybill". This has been included just to keep the code as simple as possible. You could put in some code to tell the interpreter not to process the <waybill> tags and only change the others.

We could easily create similar translation documents for any number of input documents. This would allow us to translate all input documents with the same ASP page.

1999 Wrox Press Limited, US and UK.

Previous Page Table Of Contents Next Page
 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

View all Jobs (Add yours)
View all CV (Add yours)



chicago web site design
United Kingdom Conference Calling
Host Department NOLIMIT Web Hosting
UK Hosting
designer sunglasses
PA Pool Contractor
answering service
online fax
swimming pool contractor
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP