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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Add Condition check in a multi... (3)
-> + Eliminating Duplicates with XS... (3)
-> + Empty tags in XML (2)
-> - XML to XML transformations (5)
-> ->XML to XML transformation...
-> ->XML to XML transformation...
-> ->XML to XML transformation...
-> ->XML to XML transformation...
-> + XSLT problem (3)
-> + XSLT and Array (6)
-> + Problem with transforming XMLs... (3)
-> + Logging in XSLT? (3)
-> + svg can not view with msxml pr... (3)
-> + Newbie Sorting Question (5)
-> + xslt - get values from fist no... (5)
-> + RenderX logo at the buttom of ... (2)
-> + consolidate same nodes into on... (4)
-> + HOW DO I GET THE XSLT MAPPER? (2)
-> + Newbie - dublicating attribute... (2)
-> + Correct use of sum() (3)
-> + Using the sum() function (4)
-> + Prublem in XSLT (6)
-> + Newbie XPath Question (10)
-> + Reference to variable or param... (3)
-- Previous [1381-1400] [1401-1420] [1421-1440] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
steven matthewsSubject: XML to XML transformations
Author: steven matthews
Date: 13 Aug 2006 12:01 PM
HI XSLT Experts,

The following "flat" XML file needs to be transformed by re-arranging the nodes (elements) and adding a few new ones.

</invoices>
<inv_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>
</inv_rec>
</invoices>

The above XML needs to transformed, using XSLT, into this more structured XML:

<invoices>
<inv_rec>
<invoiceNum>110</invoiceNum>
<tbl_lines>
<prodCode>FP001</prodCode>
<tbl_products>
<prodName>Flamingo Slippers</prodName>
<prodDesc>Pink fluffy flamingo slippers</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>
</inv_rec>
</invoices>

I am not asking for full XSLT code but simply for some advice on how to convert
from one XML vocab into another (without formatting). I just need some advice on how
to:

* create a new XML file while retaining the old one
* create new elements
* make existing elements sub-nodes of new elements

(The xslt examples that I am familiar with ALL involve XML to HTML transformations
in a web browser.)

Any advice would be appreciated,

regards,

bigSteve


Postnext
Ivan PedruzziSubject: XML to XML transformations
Author: Ivan Pedruzzi
Date: 15 Aug 2006 05:10 PM
Hi Steven,

It seems to be a straightforward mapping, please see the attached image.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team


Documentinvoice.jpg

Postnext
steven matthewsSubject: XML to XML transformations
Author: steven matthews
Date: 16 Aug 2006 09:37 AM
THanks again Ivan,

Although this is useful what I really would like to have is some sort of insight into how this can be done programmatically using XSLT.

Nearly all examples in XSLT web sites refer to XML : HTML transformations which I guess is not too surprising since that seems to be the main purpose of XSLT.

I am not looking for code - just some pointers on how to convert one XML vocab into anther XML vocab ...

regards,

Steven Matthews

Postnext
Tony LavinioSubject: XML to XML transformations
Author: Tony Lavinio
Date: 16 Aug 2006 10:34 AM
If you do the mapping using the Stylus Studio XSLT mapper tool,
it will generate the corresponding XSLT in real-time in the lower
portion of the window, so you can see exactly how the mapping
works. This should give you a good idea how to do this on your
own.

As a plus side, you get pre-written XSLT. And if you modify the
XSLT in the lower window, the map in the upper window is updated
accordingly.

Posttop
steven matthewsSubject: XML to XML transformations
Author: steven matthews
Date: 17 Aug 2006 06:22 AM
THanks for that ...

Steven

   
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.