Hi,
We are currently migrating our website from a pure JSP environment to Cocoon and have run into a problem.
Welcome in the world of XML.
The majority of our webpages have a header and footer, both of which are fragments of xhtml documents, that we would like to include on each page. We have tried using the CInclude transformer to include these elements, but cocoon seems to be upset that the files are not well formed (see error message below).
/
org.apache.cocoon.ProcessingException: Failed to execute pipeline.: file:/static/headerTest.html:6:1:org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
/We have also tried the XInclude transformer without success. Is there a way to include fragments of XHTML/XML documents in larger documents to create one well-formed document?
*Ouch* No, hopefully not :) Seriously, you must switch to thinking in XML. The code below is really bad an error prone (even if it would work). What happens if you change something in headerTest.html, but not in footerTest.html?
For XML it should more look like:
file:/static/test.html
<html xmlns:c="http://apache.org/cocoon/include/1.0"> <body> <table> <tr> <td> <c:include src="static/headerTest.html"/> </td> </tr> <tr> <td> <b>The Body</b> </td> </tr> <tr> <td> <c:include src="static/footerTest.html"/> </td> </tr> </table> </body> </html>
This approach should also be flexible enough as header and footer can consist of nearly arbitrary HTML.
Joerg
I have included some sample code below.
------------------------------------------------------------------------
*file:/static/test.html*
/<html xmlns:c="http://apache.org/cocoon/include/1.0"> <c:include src="static/headerTest.html"/> <b>The Body</b> <c:include src="static/footerTest.html"/> </html>/
*file:/static/headerTest.html*
/<body> <table> <tr> <td>
/*file:/static/footerTest.html*
/ </td> </tr> </table> </body>/
-------------------------------------------------------------------------
Any help would be greatly appreciated.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
