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
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
rajat nairSubject: Mapping Trouble
Author: rajat nair
Date: 19 Dec 2007 12:43 PM
Hi,
I m trying to map xml to xml using the mapping feature in the stylus studio enterprise suite and is unable to map a case like the following

<RequestDetail>
<ItemNumber source="me">12345</ItemNumber>
<ItemNumber source="we">abcd</ItemNumber>
<ItemNumber source="see">blahblah</ItemNumber>
</RequestDetail>
In the above xml snippet i want the first ItemNumber source "me" to get mapped to <firsthere> tag in the target xml and the second ItemNumber source "we" to get mapped to <secondhere> tag in the target xml, but when i add the source xml to the mapping utility, it just shows

ItemNumber
-- source

How do i resolve this, any help would be appreciated.

Regards
Rajat

Postnext
Minollo I.Subject: Mapping Trouble
Author: Minollo I.
Date: 19 Dec 2007 01:45 PM
If I drag&drop a source document with the structure you are describing, I see:
- RequestDetail
- ItemNumber
- source

...which is what I would expect. the panel shows the *structure* of the document, not its data. To do something like what you are describing, you need to create some mapping to a specific structure; possibly with "if" conditions if such mapping is controlled by values rather than by structure.

If you provide a few more details, we can try to get you started; what is the structure, the schema of the result you are trying to get? What is the logic you follow to map information in the source to that structure? Is it based on position of the elements in the source document? Or on values of the attributes?

Postnext
rajat nairSubject: Mapping Trouble
Author: rajat nair
Date: 19 Dec 2007 03:14 PM
I have emailed the source document to stylus-field-report@progress.com
yes the mapping has to be attribute value based.The source doucment has to be mapped out into a OAG target document.

>If I drag&drop a source
>document with the structure
>you are describing, I see:
> - RequestDetail
> - ItemNumber
> - source
>
>...which is what I would
>expect. the panel shows the
>*structure* of the document,
>not its data. To do something
>like what you are describing,
>you need to create some
>mapping to a specific
>structure; possibly with "if"
>conditions if such mapping is
>controlled by values rather
>than by structure.
>
>If you provide a few more
>details, we can try to get you
>started; what is the
>structure, the schema of the
>result you are trying to get?
>What is the logic you follow
>to map information in the
>source to that structure? Is
>it based on position of the
>elements in the source
>document? Or on values of the
>attributes?

Posttop
Minollo I.Subject: Mapping Trouble
Author: Minollo I.
Date: 19 Dec 2007 03:58 PM
I'm not going into the details of your whole mapping goals, but value based mappings can be usually accomplished creating chains of if conditions in mapper (and XQuery). See this XQuery, for example, in mapper; it should give you an idea about how it works.

<root>
{
for $RequestDetail in doc('file:///c:/Tp_request.xml')/TradePowerRequest/RequestDetail
return
<items>
{
if( $RequestDetail/ItemNumber/@source = "UI" ) then
<item1>
{$RequestDetail/ItemDescription/text()}
</item1>
else
()
}
{
if( $RequestDetail/ItemNumber/@source = "MP" ) then
<item2>
{$RequestDetail/ItemDescription/text()}
</item2>
else
<item3>
{$RequestDetail/ItemDescription/text()}
</item3>
}
</items>
}
</root>

 
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.