I have the following XML sturture in my project. I need to write somthing that transposes repeating nodes to make a flat stuture
<bookstore>
<book >
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book >
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book>
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
I want to flaten the sturture like this
<bookstore>
<bookonetitle lang="en">Everyday Italian</bookonetitle>
<bookoneauthor>Giada De Laurentiis</bookoneauthor>
<bookoneyear>2005</bookoneyear>
<bookoneprice>30.00</bookoneprice>
<booktwotitle lang="en">Harry Potter</booktwotitle>
<booktwoauthor>J K. Rowling</booktwoauthor>
<booktwoyear>2005</booktwoyear>
<booktwoprice>29.99</booktwoprice>
<bookthreetitle lang="en">Learning XML</bookthreetitle>
<bookthreetitle>Erik T. Ray</bookthreetitle>
<bookthreetitle>2003</bookthreetitle>
<bookthreetitle>39.95</bookthreetitle>
</bookstore>
Your output structure strikes me as being very awkward. You might like to reconsider it. But in any case, this XSLT 1.0 style-sheet…
…will transform your sample input into…