我在我的項目中有以下XML sturture。我需要寫的財產以後該調換重複的節點,使扁平stutureXML flaten重複節點
<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>
我想flaten的sturture這樣
<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>
它僅限於3?或者可以有任何號碼?很難將數字轉換爲英文拼寫的數字。也許像書名一樣的元素名稱就足夠了? –
XSLT 1.0?或2.0? –
我很好奇你爲什麼要將數據放入元素名稱中,而不是僅僅具有附加屬性的書籍平面結構。重組的目標是什麼? –