I have spent a multitude of hours on this one and am at my wits end.
The XML-input is as follows, mildly simplified:
<div>
<pagebreak img="filename_001.gif"/>
<head>The history of the magnificient bla</head>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<pagebreak img="filename_002.gif"/>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<pagebreak img="filename_003.gif"/>
etc..
</div>
The output is supposed to be like this:
<pagebreak img="filename_001.gif"/>
<div class="page-content-container">
<head>The history of the magnificient bla</head>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
</div>
<pagebreak img="filename_002.gif"/>
<div class="page-content-container">
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
<text>bla, bla, bla...</text>
</div>
<pagebreak img="filename_003.gif"/>
etc..
All I need to do really, is to introduce the <div class="page-content-container"> as a parent node to all siblings except the <pagebreak>-element. I'm new at XSLT, and the experienced might laugh at this problem, but I have tried everything. Mostly variants of <xsl:for-each/> as my small brain can't seem to accept that XSLT doesn't support conditional loops.
I've had a look at this thread:
http://p2p.wrox.com/topic.asp?TOPIC_ID=38896
It concerns a similar problem, but I can't seem to implement the solution in a way that works for me.
I hope you will waste some time on me =)