cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laurent_ror...@marinepower.com
Subject Re: Including Fragments
Date Thu, 15 Apr 2004 07:42:43 GMT
Dear Garrik,

I encounter such a thing and I think that the best way is using the 
AGGREGATE 

what I have done , I create a resource  and I call this resource from my 
pipeline with parameters:

>>>>>>>>>>>>>>>>>>>>>>>>>>
 RESOUNCE
<map:resource name="show-simple-page" label="content">
                        <map:act type="locale">
                                <map:aggregate element="PAGE" label=
"aftergenerator  ">
                                        <map:part src=
"cocoon:/internal-portal/top" element="TOP" strip-root="true"/>
                                        <map:part src=
"cocoon:/internal-portal/left" element="LEFT" strip-root="false"/>
                                        <map:part src="{../page}" element=
"BODY" strip-root="true"/>
                                        <map:part src=
"cocoon:/internal-portal/bottom" element="BOTTOM" strip-root="false"/>
                                </map:aggregate>
                                <map:transform type="xslt" src=
"{../style}" label="afterstyle"/>
                                <map:transform type="translator" label=
"afteri18n , print, search  ">
                                        <map:parameter name="locale" 
value="{locale}"/>
                                </map:transform>
                                <!-- PAY ATTENTION -->
                                <!-- This transformer is required to 
remove the comment tag at the end of the pipeline -->
                                <!-- We have to do that because, we import 
some Notes Content in the XML Stream as a comment -->
                                <!-- and if we remove the comment to fast 
, we will lost the info -->
                                <!-- So, at the end of all the pipelines, 
we remove the comment tag -->
                                <map:transform src=
"context://stylesheets/system/mpe_clean_comment.xsl" label="content">
        </map:transform>
                                <map:serialize label="links, content"/>
                                <!-- 
-->
                                <!--  For Debug -->
                                <!--
        <map:serialize type="xml"/>

-->
                        </map:act>
                </map:resource>


============================


>>>>>>>>>>>>>>>>>>>>>>>>>>
 PIPE
        <!-- Main Entry for all pages -->
                                <map:match pattern="**" label="content">
                                        <map:call resource=
"show-simple-page">
                                                <map:parameter name="page" 
value="cocoon:/internal-portal/{0}"/>
                                                <map:parameter name=
"style" value="context://stylesheets/mpe_simple.xsl"/>
                                        </map:call>
                                </map:match>





Garrick Dasbach <Garrick@musicrebellion.com>
14/04/2004 18:08
Please respond to users
 
        To:     users@cocoon.apache.org
        cc: 
        Subject:        Including Fragments


Hi,

We are currently migrating our website from a pure JSP environment to 
Cocoon and have run into a problem. 

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?

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.

-- 

____________________________
Garrick Dasbach
Software Development
Digonex Technologies, Inc.
317.638.4174 Fax



CONFIDENTIALITY NOTICE:  The information in this transmission is private, 
confidential, may be legally privileged, is property of the sender and is 
intended solely for the use of the addressee.  If you are not the 
addressee, you should not read, disclose, distribute, copy, use or rely 
upon the information contained in this transmission.  If you have received 
this transmission in error please delete or destroy it and notify DIGONEX 
TECHNOLOGIES, INC. immediately at (317) 638-4154.


Mime
View raw message