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
eran berkowitzSubject: complex mapping
Author: eran berkowitz
Date: 10 Mar 2005 02:50 AM
HI,
I have a problem which I have a feeling can be solved easely but I guess
I just can't see it.
I want to go from this input -
************
<Hobbies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="output_schema.xsd">
<Hobby Hobby_N="Swimming">
<Person firstName="Erick" lastName="Smith"/> </Hobby> <Hobby
Hobby_N="Biking"> <Person firstName="Elizabeth" lastName="Doe"/>
</Hobby> <Hobby Hobby_N="Painting"> <Person firstName="Marry"
lastName="Smith"/> </Hobby> <Hobby Hobby_N="Swimming"> <Person
firstName="Edward" lastName="Doe"/> </Hobby> </Hobbies>

to this output
****************************8
<Hobbies>
<Hobby name="Swimming">
<Person firstName="Erick" lastName="Smith"> </Person> <Person
firstName="Edward" lastName="Doe"> </Person> </Hobby> <Hobby
name="Biking"> <Person firstName="Elizabeth" lastName="Doe"> </Person>
</Hobby> <Hobby name="Painting"> <Person firstName="Marry"
lastName="Smith"> </Person> </Hobby> </Hobbies>
*************

I know that XSLT2 supports rouping by and sorting but I can't find these
functions in the mapper.
any help would be greatly appriciated

Thanks
Eran

Postnext
(Deleted User) Subject: complex mapping
Author: (Deleted User)
Date: 11 Mar 2005 10:55 AM
Hi, Eran

As you said, the problem you are trying to solve is much easier to do in XSLT 2 through grouping feature.
Current version of mapper does not have visual grouping support. It won't help much for this particular transformation.

You can use mapper to generate a XSLT skeleton(say you link Hobby to Hobby, mapper will generate a for-each for you),
then you can go to code pane to modify the code for your grouping logic.

Let us know if you need help in writing xslt code to do this grouping.

Thanks for using Stylus Studio.

song.

Postnext
eran berkowitzSubject: complex mapping
Author: eran berkowitz
Date: 13 Mar 2005 08:42 AM
Hi,
If you could create such an exmample that would be great!

do you know when you will support such features in the GUI?

Postnext
(Deleted User) Subject: complex mapping
Author: (Deleted User)
Date: 14 Mar 2005 03:36 PM
I assume you know how to do grouping in XSLT2 which is straight forward. here is one way to do it in<br> xslt1. The idea is to use two level of for-each to get the persons with unique @Hobby_N. in the <br> inner for-each, you can group all those personas with same @Hobby_N together.<br> <br> <br> <?xml version='1.0'?><br> <xsl:stylesheet version="1.0" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform"&gt;">">http://www.w3.org/1999/XSL/Transform"></a><br> <br> <xsl:template match="/"><br> <Hobbies><br> <xsl:for-each select="Hobbies/Hobby[not(@Hobby_N = preceding-sibling::Hobby/@Hobby_N)]"><br> <Hobby name="{@Hobby_N}"><br> <xsl:for-each select="../*[@Hobby_N = current()/@Hobby_N]"><br> <xsl:copy-of select="*"/><br> </xsl:for-each><br> </Hobby><br> </xsl:for-each><br> </Hobbies> <br> </xsl:template><br> <br> </xsl:stylesheet><br> <br> <br>

Posttop
(Deleted User) Subject: complex mapping
Author: (Deleted User)
Date: 14 Mar 2005 03:43 PM
Please ignore all those <br>s in the code, that was insertered by the forum editing.

 
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.