cancel
Showing results for 
Search instead for 
Did you mean: 

SplitByValue

Former Member
0 Kudos

hi,

Need to map the Source to Target

Source:

<a>

<qualf>001</qualf>

<text>short-description</text>

<a>

<a>

<qualf>002</qualf>

<text>long-description</text>

<a>

<b>

<text1>tax language description</text1>

<email>email description</email>

</b>

Target:

<ext name="short-description">long-description</ext>

<ext name="Tax Language">tax language description</ext>

<ext name="Receiving Contact">email description</ext>

if a/qualf = '001' then i have to add the short-description to the /ext/name attribute as shown above

if a/qualf = '002' then i have to add the long-description to the /ext attribute as shown above

remaining two lines i have to hardcode the /ext/name attribute to "Receiving Contact" and "Tax Language" respectively and the description has to be

mapped to the /ext/name and /ext respectively.

I tried to use SplitByValue but i couldn't achieve the above result.

How can i achieve the above target?

Thanks,

Tirumal

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Hi Tirumal,

Do you need both entries, short text <b>and</b> long text?

Then you have to duplicate the subtree. You need for nodes ext on target side.

The first node you apply:

       qualf*    
               equalS  
constant(001) /        ifWithoutElse - ext
                text* /

  • set context up one level.

the second ext the same with constant 002.

the third ext: apply text1.

the forth ext: apply email.

for the attributes name just apply constansts.

Regards

Stefan

Former Member
0 Kudos

Stefan,

I will work on this and get back to you.

Thanks,

Tirumal

Former Member
0 Kudos

Stefan -

I am able to map the Qualf - 001 and 002 with the texts to the <ext>.

<ext> is 0..unbounded with the <name> as attribute.

How could i map the third and fourth elements to ext i.e., text1 and email since <ext> is already mapped to qualf.?

Let me know how i could do it.

Thanks,

Tirumal

stefan_grube
Active Contributor
0 Kudos

Right click on node ext, choose "Duplicate Subtree" from context menu. Repeat until you have 4 nodes ext.

Regards

Stefan

Former Member
0 Kudos

Stefan -

Did that.

I get an error saying

"Cannot produce target element

/xml/ext/name. Check xml instance is valid...."

I have in total 3 ext. Two sub trees based on the Original <ext>. Target says Ext[1], Ext[2].

Any ideas why this error message.

Thanks,

Tirumal

Former Member
0 Kudos

Stefan -

The first node <ext> long description comes from Qualf -002 and the ext/name comes from short description from Qualf - 001.

In your solution you mentioned to create 2 <ext> nodes but we need to create only 1 <ext> node here.

Please check the sample i have given carefully.

Thanks,

Tirumal

Former Member
0 Kudos

Stefan -

Was able to solve this by having removeContexts after the ifWithoutElse.

Thanks,

Tirumal

Answers (0)