You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by root <al...@utoronto.ca> on 2000/03/26 23:50:51 UTC

Including XML and/or XSP in an XSP file

Hi,

There are a couple of messages from a little while back  about the best
way to include the output of one page into another.
This is more or less a follow up to that.  I would like to use the
tag-lib that Stefano mentioned in his reply, but I am not having a lot
of success.  Can anyone answer the following questions:
1) From an XSP file can you include another XSP file, either through a
call to <util:include-file name="..."/> or <util:include-uri
href="..."/> and have the included XSP file be processed as part of the
calling XSP file?  For this to work is it necessary to "strip-off" the
XSP header stuff, like the XSP:page declaration and what not in the
included XSP file?
2) If that is not possible can you, from an XSP file include the output
XML of an XSP file?  This would have to be done through a call like
<util:include-uri href="..."/> and not a file include so that the
included XSP file can be processed by cocoon.  When I try to do this the
call to the uri works, but the output is then not formatted by the XSL
Stylesheet in the calling XSP page.  Does this have something to do with
the output escaping problems of xerces in the cocoon1.1.7 distribution?

Right now, I have the following XSP file called caller.xml
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylsheet href="catpage-html.xsl" type="text/xsl"?>
<xsp:page language="java"
    xmlns:xsp="http://www.apache.org/1999/XSP/Core"
    xmlns:util="http://www.apache.org/1999/XSP/Util"
>
 <page>
  <title>The titel</title>
  <content><util:include-uri
href="http://192.168.0.4:8080/cocoon/pubs/test.xml"/></content>
 </page>
</xsp:page>

When I make a call to this page through cocoon via the url:
http://192.168.0.4:8080/cocoon/pubs/caller.xml
The following is returned instead of the actual contents of my test.xml
file
{unable to include: 'http://192.168.0.4:8080/cocoon/pubs/test.xml'}
It seems like this must be a bug, because I know the file exists as I
can call it through my browser without any problems.  If that is the
case I'd be willing to take a stab at fixing it, but ...

I have taken a look at the source code and source xml files for the Util
tag library.  I can't really figure out what is what though.  It seems
like the same thing is sort of handled in two different places.  There
is both the org.apache.cocoon.processor.xsp.XSPUtil.java file and
org.apache.cocoon.processor.xsp.library.java.util.xsl file.
Both of them seem to have methods for including files.  Can anyone tell
me how these two files are related?  And also which is used when I have
<util:include-uri .../> in my XSP file?   It might just be that these
are two totally serparate files except for the fact that they share
similar names, but I can't tell.

Thanks for you help
Alex.