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)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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>

   
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.