XSLTGeneral questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
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 can't use <xsl:copy> though, as the output siblings must have new names (variations of the <class>-element). I apologize as this isn't reflected in my example above.
And to Alain: Yes, the <pagebreak>-element is the first sibling =)
I know it's been a while, but I need to revive this thread.
I ended up reverting to Alain's solution, as I'm forced to use XSLT 1.0 (XSLT must work in Zope, and our Python programmer assures me that XSLT 2.0 is not an option in this regard).
Now I have a new problem though. Before the XML is transformed it is cut down to smaller XML-files <div> by <div> (journals and monographies are thus reduced to articles and chapters). This means that a lot of pages is cut in half too. This is a problem as Alain's solution is using the pagebreaks to identify the content in between:
My question is: How do I put the content before the first PageBreak and after the last PageBreak inside <div class="page-content-container"> too, when my XML often don't start or end with a PageBreak?
Did this make any sense at all? I can post the real code if it helps =)
it would be better if you post your renewed XML input and expected output.
Probably it needs just a minor amendment from what Alain suggested you a while ago.