We help IT Professionals succeed at work.
Get Started

XSL output  solution

chicho12
chicho12 asked
on
122 Views
Last Modified: 2015-06-21
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!
Comment
Watch Question
IT Business Systems Analyst / Software Developer
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE