Link to home
Start Free TrialLog in
Avatar of sri1209
sri1209

asked on

change name of xml tags with xslt if there other tag present.

Hi i Have the following xml, just have to change the the tag name based on the existence of another tag, could anyone please direct me how to do this in xslt.

current xml:
<Details>
                        <Cash>
                                    <TitleLogo> cash.gif</TitleLogo>
                                    <Title> Benefits</Title>
                                    <Approval>
                                                <Title>Who qualifies?</Title>
                                                <TitleLogo> eligible.gif</TitleLogo>
                                                <Header1>Who qualifies?</Header1>
                                                <Header2>When?</Header2>
                                                <Header3>How Much?</Header3>
                                                <Qualified>
                                                            <Person>
                                                                        <Names>\b.PAT, PEN, TAM, TON\b0.\n\n\n\n\n.</Names>
                                                                        <When>Dec 26, 2014</When>
                                                                        <HowMuch>$158.00 twice per month</HowMuch>
                                                            </Person>
                                                </Qualified>
                                                <Footer>\b.PAT, PEN, TAM, TON\b0.: To get this benefit, you and all members of your amily must be working and have earned income that we use to determine your monthly benefit.\n\n.</Footer>
                                    </Approval>
                        </Cash>
                        <Cash>
                                    <TitleLogo> cash.gif</TitleLogo>
                                    <Title> Benefits</Title>
                                    <Rejection>
                                                <Title>Who does not qualify?</Title>
                                                <TitleLogo>d:\Apps\MCI\SAT\Adobe\Corr\Logo\icon_elig_ineligible.gif</TitleLogo>
                                                <Header1>Who?</Header1>
                                                <Header2>Date of our decision?</Header2>
                                                <Description>
                                                            <Reason>
                                                                        <Value1>\b.TAM, TON\b0.</Value1>
                                                                        <Value2>December 16, 2014\n\n.</Value2>
                                                            </Reason>
                                                </Description>
                                                <Footer>\b.TAM, TON\b0.: Inside this letter you can learn more about the income and deductions we used to decide if you qualify</Footer>
                                    </Rejection>
                        </Cash>
<Details>

Open in new window



need to change to below xml using xslt. the 2nd <cash> tag should be changed to <cashR> if there is a <Rejection> tag exists.



<Details>
                        <Cash>
                                    <TitleLogo> cash.gif</TitleLogo>
                                    <Title> Benefits</Title>
                                    <Approval>
                                                <Title>Who qualifies?</Title>
                                                <TitleLogo> eligible.gif</TitleLogo>
                                                <Header1>Who qualifies?</Header1>
                                                <Header2>When?</Header2>
                                                <Header3>How Much?</Header3>
                                                <Qualified>
                                                            <Person>
                                                                        <Names>\b.PAT, PEN, TAM, TON\b0.\n\n\n\n\n.</Names>
                                                                        <When>Dec 26, 2014</When>
                                                                        <HowMuch>$158.00 twice per month</HowMuch>
                                                            </Person>
                                                </Qualified>
                                                <Footer>\b.PAT, PEN, TAM, TON\b0.: To get this benefit, you and all members of your amily must be working and have earned income that we use to determine your monthly benefit.\n\n.</Footer>
                                    </Approval>
                        </Cash>
                       [b] <CashR>[/b]
                                    <TitleLogo> cash.gif</TitleLogo>
                                    <Title> Benefits</Title>
                                    <Rejection>
                                                <Title>Who does not qualify?</Title>
                                                <TitleLogo>d:\Apps\MCI\SAT\Adobe\Corr\Logo\icon_elig_ineligible.gif</TitleLogo>
                                                <Header1>Who?</Header1>
                                                <Header2>Date of our decision?</Header2>
                                                <Description>
                                                            <Reason>
                                                                        <Value1>\b.TAM, TON\b0.</Value1>
                                                                        <Value2>December 16, 2014\n\n.</Value2>
                                                            </Reason>
                                                </Description>
                                                <Footer>\b.TAM, TON\b0.: Inside this letter you can learn more about the income and deductions we used to decide if you qualify</Footer>
                                    </Rejection>
                        [b]</CashR>[/b]
<Details>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sri1209
sri1209

ASKER

Thanks Geert Bormans, you are awesome. i have sent you an private email
 just to thank you for your help.