Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping Many fields to one field in XSLT

Status
Not open for further replies.

pj2006

Programmer
Jan 10, 2007
2
US
Hi,
I am using WESB tool and in one of the XSLT mapping that I am working on has many fields on the source XSD that need to get one single field but different occurences of that field on the target XSD. So putting it in an example

If distinct fields, A, and B of source M go to different occurrences of Field C in array D in target N

A maps to target N.D[1].C = Source M.A
target N.D[2].C = Source M.B

at this point, I have not found any way for me to do this directly or indirectly. I can only map to one single occurence as we are not able to instantiate the target array (in the example, array D). Does anyone know a better way to do this.
 
Yes, I meant IBM's Websphere Enterprise service Bus. Well the tool we are using is IBM's Websphere Integration Developer (WID).

We are mapping source XSD with a target XSD. In this source xsd there are 2 attributes available viz. A and B. In the target there is element D which has max occurrence of 5 and a child of element D is an attribute C. We are using XPath to do XSL transformation which is basically transformation of the data passing from source to target based on the XPath we define.

So this is how the scenario of the above example will look

(target)N.(element)D[1].(attribute)C = (source)M.(attribute)A
(target)N.(element)D[2].(attribute)C = (source)M.(attribute)B

we are not able to change the occurrences on element D as its the target. I hope this explanation helps

I wish i was able to post a snapshot of the graphical editor for (WID) to give a better understanding on this.

 
Well, on the assumption that you are correct in your description, you are describing a shortcoming of the tool, not of XSLT. XSLT can certainly do what you are describing.
Code:
...
   <N>
       <D>
           <xsl:attribute name="C">
              <xsl:value-of select="//M/@A"/>
           </xsl:attribute>
       </D>
       <D>
           <xsl:attribute name="C">
              <xsl:value-of select="//M/@B"/>
           </xsl:attribute>
       </D>
  </N>
...

So, switch to text mode and see if you can type in what you need. Then see how the GUI renders it.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top