I have an XML file which contains a load of nested divs. I'm trying to write some XSL to create a new XML file with all the excess divs removed, but I want to retain the content and place this in paragraph tags.
Here is a snippet of the code:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <Content>
- <div>
- <div>this is some content</div>
- <div>
- <div>
- <div>this is some more content</div>
- <div>
- <div>
- <div>and some more and more and more</div>
- <div>
- <div>
- <div>more more more more</div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </Content>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <Content>
- <p>this is some content</p>
- <p>this is some more content</p>
- <p>and some more and more and more</p>
- <p>more more more more</p>
- </Content>
Sounds easy, but I don't what is the best way to handle this, could I use a for-each to iterate through the elements, or write a recursive template to handle the divs?
Any help much appreciated.