XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Steven MatthewsSubject: XML to XML transformation
Author: Steven Matthews
Date: 07 May 2006 01:21 PM
Hi There,

I simply need to transform some XML in one format to another. I have been using some middleware to return XML from a relational database using an XML query. Here is an XML dataset sample:

<database URL="jdbc:odbc:SPM">
<NSW QUERY="select invoice.invoiceNum,salesDate,shipToAddress,shipToCity,shipToState,shipToZip,contactName,
contactPhone,lines.prodCode,salesQty,prodName,prodDesc,prodPrice,products.supCode,supplierName,
supplierAddress,supplierCity,supplierState,supplierPhone,supplierFax,supplierContact
from invoice, lines, products, suppliers
where invoice.invoiceNum = lines.invoiceNum and lines.prodCode = products.prodCode and products.supCode = suppliers.supCode
and invoice.shipToState = 'NSW'"
>
<NSW_rec>
<invoiceNum>110</invoiceNum>
<salesDate>19. Aug. 01</salesDate>
<shipToAddress>32 Palm Ave</shipToAddress>
<shipToCity>Batemans Bay</shipToCity>
<shipToState>NSW</shipToState>
<shipToZip>2986</shipToZip>
<contactName>Christian</contactName>
<contactPhone>2734-8564</contactPhone>
<prodCode>FP001</prodCode>
<salesQty>34</salesQty>
<prodName>Flamingo Slippers</prodName>
<prodDesc>Pink fluffy flamingo slippers with rubber soles</prodDesc>
<prodPrice>20.0000</prodPrice>
<supCode>s0001</supCode>
<supplierName>Jacks Apparell</supplierName>
<supplierAddress>34 Westbourne Ave</supplierAddress>
<supplierCity>Melbourne</supplierCity>
<supplierState>Vic</supplierState>
<supplierPhone>9658-2345</supplierPhone>
<supplierFax>9658-2346</supplierFax>
<supplierContact>Terry</supplierContact>
</NSW_rec>
</NSW>
</database>

I need to be able to transform, using XSLT, this rather flat data into something more hierarchical. The <NSW_rec> actually needs re-structuring, to this:

<NSW_rec>
<invoiceNum>110</invoiceNum>
<tbl_lines>
<prodCode>FP001</prodCode>
<tbl_products>
<prodName>Flamingo Slippers</prodName>
<prodDesc>Pink fluffy flamingo slippers with rubber</prodDesc>
<prodPrice>20.0000</prodPrice>
<supCode>s0001</supCode>
<tbl_suppliers>
<supplierName>Jacks Apparell</supplierName>
<supplierAddress>34 Westbourne Ave</supplierAddress>
<supplierCity>Melbourne</supplierCity>
<supplierState>Vic</supplierState>
</tbl_suppliers>
<supplierPhone>9658-2345</supplierPhone>
<supplierFax>9658-2346</supplierFax>
<supplierContact>Terry</supplierContact>
</tbl_products>
<salesQty>34</salesQty>
</tbl_lines>
<salesDate>19. Aug. 01</salesDate>
<shipToAddress>32 Palm Ave</shipToAddress>
<shipToCity>Batemans Bay</shipToCity>
<shipToState>NSW</shipToState>
<shipToZip>2986</shipToZip>
<contactName>Christian</contactName>
<contactPhone>2734-8564</contactPhone>
</NSW_rec>

I have has some practice converting XML to XHTML but not XML to other XML.

Any advice or tips would be appreciated,

Steven Matthews


Postnext
Ivan PedruzziSubject: XML to XML transformation
Author: Ivan Pedruzzi
Date: 07 May 2006 02:20 PM

The mapping looks pretty straightforward, did you try using XML to XML mapper?

http://www.stylusstudio.com/xslt_mapper.html

Ivan Pedruzzi
Stylus Studio Team

Posttop
Jack BradinSubject: XML to XML transformation
Author: Jack Bradin
Date: 11 Jul 2006 02:59 PM
Try the Mapper - pretty usefull!!

http://www.jx9media.com

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.