XSLT Needed???

Discussion in 'XML' started by vipulksinha, Jun 10, 2008.

  1. vipulksinha

    vipulksinha

    Joined:
    Jun 10, 2008
    Messages:
    1
    Hi All,
    Looks to be a simple issue, but having tried several approaches without
    any success, I am posting it here.

    I have an XML in one format and I want to now convert into another XML
    format using XSLT.

    Original XML:

    <StartList>
    <Start>​
    <Element1>some text</Element1>
    <Element2>some text</Element2>
    <Element3>some text</Element3>
    <Element4>​
    <SubElement1/>
    <SubElement2/>
    <SubElement3/>​
    </Element4>​
    </Start>
    <Start>​
    <Element1>some text</Element1>
    <Element2>some text</Element2>
    <Element3>some text</Element3>
    <Element4>​
    <SubElement1/>
    <SubElement2/>
    <SubElement3/>​
    </Element4>​
    </Start>​
    </StartList>


    Transformed XML:

    <StartList>
    <Start>​
    <Element1>some text</Element1>
    <Element2>some text</Element2>
    <Element3>some text</Element3>
    <Element4>​
    <NEWSubElement>Value from "Element1"</NEWSubElement>
    <SubElement1/>
    <SubElement2/>
    <SubElement3/>​
    </Element4>​
    </Start>
    <Start>​
    <Element1>some text</Element1>
    <Element2>some text</Element2>
    <Element3>some text</Element3>
    <Element4>​
    <NEWSubElement>Value from "Element1"</NEWSubElement>
    <SubElement1/>
    <SubElement2/>
    <SubElement3/>​
    </Element4>​
    </Start>​
    </StartList>

    As you could see, I want to copy the value of the "Element1" in a newly created "NEWSubElement". I want to do this for every child (in this case "Element4"), which has children ("SubElement1", "SubElement2" etc) of its own.

    Any help would be deeply appreciated!

    Thanks.
    vipulksinha, Jun 10, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    635
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,658
    Dimitre Novatchev
    Sep 25, 2003
  3. ted
    Replies:
    1
    Views:
    610
    Laurens
    Jan 26, 2004
  4. sneill@mxlogic.com
    Replies:
    2
    Views:
    705
    Henry S. Thompson
    Oct 19, 2005
  5. dar_imiro@hotmail.com
    Replies:
    4
    Views:
    653
    dar_imiro@hotmail.com
    Dec 13, 2005
Loading...

Share This Page