changeone xml schema to another usinf xslt?

P

parth

I have the following XML file -

<root>
<book>
<section>art</section>
<title>abc</title>
<author>mark</author>
</book>
<book>
<section>science</section>
<title>def</title>
<author>jeff</author>
</book>
<book>
<section>art</section>
<title>pqr</title>
<author>tracy</author>
</book>
<book>
<section>science</section>
<title>xyz</title>
<author>albert</author>
</book>
</root>


I want to convert the above schema to look like the following schema
-


<root>
<section>
<name>art</name>
<book>
<title>abc</title>
<author>mark</author>
</book>
<book>
<title>pqr</title>
<author>tracy</author>
</book>
</section>


<section>
<name>science</name>
<book>
<title>def</title>
<author>jeff</author>
</book>
<book>
<title>xyz</title>
<author>albert</author>
</book>
</section>
</root>


Can this be done using XSLT? How can I change the schema?
Thanks in advance.


- Parth
 
A

Andy Dingley

parth said:
Can this be done using XSLT? How can I change the schema?

This isn't a "schema change" problem, and searching for such a thing
will mislead you. Years ago we used to hear a lot about "XSLT as the
universal solution to schema mapping", but it never really worked.

What you have here is basically the same schema, but re-organised. Your
problem is more of a grouping problem and you should find the
following helpful
http://jenitennison.com/xslt/grouping/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top