Jump to content

nagabhb@gmail.com

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by nagabhb@gmail.com

  1. Hi , Need xslt help for the below conversion.

    Currently we are iterating based on the accNo , however would like to check if we get a better solution using Muenchian Method.


    Input:


    <Details>

    <GroupA>

    <rec1A>

    <accNo>123</accNo>

    <accName>abc</accName>

    </rec1A>

    <rec2A>

    <accNo>234</accNo>

    <accName>xyz</accName>

    </rec2A>

    </GroupA>

    <GroupB>

    <rec1B>

    <accNo>123</accNo>

    <accValue>100</accValue>

    </rec1B>

    <rec2B>

    <accNo>234</accNo>

    <accValue>200</accValue>

    </rec2B>

    </GroupB>

    <GroupC>

    <rec1C>

    <accNo>123</accNo>

    <accAddress>address1</accAddress>

    </rec1C>

    <rec2C>

    <accNo>234</accNo>

    <accAddress>address2</accAddress>

    </rec2C>

    </GroupC>

    </Details>


    Output:


    <Details>

    <Group1>

    <rec1A>

    <accNo>123</accNo>

    <accName>abc</accName>

    </rec1A>

    <rec1B>

    <accNo>123</accNo>

    <accValue>100</accValue>

    </rec1B>

    <rec1C>

    <accNo>123</accNo>

    <accAddress>address1</accAddress>

    </rec1C>

    </Group1>

    <Group2>

    <rec2A>

    <accNo>234</accNo>

    <accName>xyz</accName>

    </rec2A>

    <rec2B>

    <accNo>234</accNo>

    <accValue>200</accValue>

    </rec2B>

    <rec2C>

    <accNo>234</accNo>

    <accAddress>address2</accAddress>

    </rec2C>

    </Group2>

    </Details>


    Thanks.

  2. Hi , Need help in xslt logic.

     

    I've to read the 'HierCd' element value from the below input xml and

     

    if the value is 003 then create a tag like <MCA> 000000001003782 </MCA> // fetch the value of corresponding CntlAcctNbr

    if the value is 004 then create a tag like <BCA> 378571802991005 <BCA> // fetch the value of corresponding CntlAcctNbr

    If the value is 005 then create a tag like <LCA>378571802991006</LCA> // fetch the value of corresponding CntlAcctNbr

     

    Please note that there could be multiple elements exist with same 'HierCd' , however need to read the first entry and discard remaining.

     

     

    Input XML:

     

    <CardAcctHierarchyRln>
    <CorpId>702653</CorpId>
    <CorpNm></CorpNm>
    <CardAcctHierarchy>
    <CntlAcctNbr>000000001003782</CntlAcctNbr>
    <CntlAcctNm></CntlAcctNm>
    <HierCd>003</HierCd>
    </CardAcctHierarchy>
    <CardAcctHierarchy>
    <CntlAcctNbr>378571802991005</CntlAcctNbr>
    <CntlAcctNm></CntlAcctNm>
    <HierCd>004</HierCd>
    </CardAcctHierarchy>
    <CardAcctHierarchy>
    <CntlAcctNbr>378571802991006</CntlAcctNbr>
    <CntlAcctNm></CntlAcctNm>
    <HierCd>005</HierCd>
    </CardAcctHierarchy>
    <CardAcctHierarchy>
    <CntlAcctNbr>378571802991004</CntlAcctNbr>
    <CntlAcctNm></CntlAcctNm>
    <HierCd>004</HierCd>
    </CardAcctHierarchy>
    <CardAcctHierarchy>
    <CntlAcctNbr>378571802991004</CntlAcctNbr>
    <CntlAcctNm></CntlAcctNm>
    <HierCd>003</HierCd>
    </CardAcctHierarchy>

    </CardAcctHierarchyRln>

    OutPut:

     

    <MCA> 000000001003782 </MCA>

    <BCA> 378571802991005 <BCA>

    <LCA>378571802991006</LCA>

     

    Appreciate your help on this.

     

    Thanks

    Nag

×
×
  • Create New...