Avatar of chicho12
chicho12
 asked on

XSL output solution

Hi,
      I am new to XSL and I'm having issues coming up with a solution for this problem.
      I have the XML structure below:
      <Root>
      <CUs>
            <CU>                  
                  <ContractNr>12345</ContractNr>                  
                  <FullName>Alison full</FullName>            
                  <id>111</id>      
            </CU>
            <CU>                  
                  <ContractNr>45678</ContractNr>                  
                  <FullName>Nancy Full</FullName>      
                  <id>222</id>                  
            </CU>            
      </CUs>      
      <Results>
            <Result>
         <AccountId>0000-0000-0005</AccountId>
         <OrgNr>12345</OrgNr>
             <Status>Active</Status>
             <FullName>Alison full</FullName>
        </Result>
        <Result>
          <AccountId>0000-0000-0005</AccountId>
          <OrgNr>45678</OrgNr>
          <Status>Active</Status>
          <FullName>Steve Full</FullName>
        </Result>                  
      </Results>      
</Root>
      
      
      I need using XSLT to output the following XML result:
      <Output>
       <Customer>
        <ContractNr>45678</ContractNr>      
        <FullName>Nancy Full</FullName>
        <Status>Active</Status>
       </Customer>
      </Output>
      
      What i need is to loop into all <CU> and using the <ContractNr> value to finds its match <Result>.  The <OrgNr> of a Result will contain the same value as <ContractNr> in a CU.
      Once the 2 records are matched I need to compare the FullName from the <CU> against the FullName of the <Result>. If the FullNames are not the same then output the XML above.
      If the fullname is the same then do nothing.
      So the output xml above is what I'd get if i use the input xml at the begining.      
      Thanks!
XML

Avatar of undefined
Last Comment
mccarl

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
mccarl

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
chicho12

ASKER
Great tips. Thanks for the help!!
mccarl

You're welcome!!
Your help has saved me hundreds of hours of internet surfing.
fblack61