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
gavin clarkSubject: nested for-each / grouping ?
Author: gavin clark
Date: 21 Sep 2005 12:37 PM

I'm sure this is a common problem .. well I'm hoping it is !.

We've got an extract of data which comes out of an access database to invoice customers. Currently we print them but now the customer has the ability to receive via xml.

The structure of the file (after conversion to XML) is roughly

< file header >
<invoice header>
<invoice line>
<invoice trailer>
<invoice header>
<invoice line>
<invoice trailer>
< file trailer >

and the target XML is in a similar layout.

What I wanted to do was use the for-each , so that is processes the lines within the header etc. If I map the header -> header using for-each the results are as I expect, for each invoice header there's a corresponding output. As soon as I add the for-each to the lines, Stylus studio seems to go bananas and use 100% CPU and appears to hang.

Cutting down the number of input records I can see that it maps every line for every invoice, so for each invoice there's for example 20 lines !.

Perhaps I'm not understanding how it's supposed to work or the input structure isn't correct ?.

Either way I'm stuck and I'd like some help please !!



input XML data

xslt mapper stylesheet

target xml structure

Ivan PedruzziSubject: nested for-each / grouping ?
Author: Ivan Pedruzzi
Date: 21 Sep 2005 03:35 PM
Hi Gavin,

I tried your stylesheet with 6.3 377n and it seems to work fine.

What Stylus Studio version/build are you running?
If you are not running the latest version could you please give it a try?

Thank You
Ivan Pedruzzi
Stylus Studio Team

gavin clarkSubject: nested for-each / grouping ?
Author: gavin clark
Date: 21 Sep 2005 05:08 PM

OK I've downloaded the latest build thanks, yes it works (well it does the transform) , but i'm not getting the results im expecting.

I think I have more of a problem in my source XML data (which is converted from a delimeted text file).

Basically for each <invhdr> record there may be one or more <invlin> records, but as you can see the input xml data doesn't really contain that structure, it's a 'classical' header & detail records type layout.

What I can't see how to do in the 'convert to xml' is how to associate a 'header / detail' relationship, if my input data is just simply rows of text, how can i tell Style Studio that an <invlin> record is a child of <invhdr> ?.

I've attached my input data, converter to this message.

thanks in advance


delimted text file

text to xml converter

Tony LavinioSubject: nested for-each / grouping ?
Author: Tony Lavinio
Date: 26 Sep 2005 03:35 PM
See http://www.stylusstudio.com/SSDN/default.asp?action=9&read=4216&fid=48

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!  

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.