You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2003/08/22 12:31:49 UTC

XInclude

Hi all,

I am using Cocoon under Forrest.

<xinclude:include href="abc.xml" />

 does not behave correctly. The xml:base is set to the top-level
directory, i.e. content/, and not to the same directory as the
including document as the spec says.
Setting the xml:base attribute to the current directory, absolute or
relative to the content/, works but is not a solution.

Mounting a sub-sitemap with a uri-prefix to that directory does not
help, still relative to content/.

Has this been fixed recently, or is it on someone's radar? Any
workaround (except setting the xml:base in each document).

Niclas



Re: XInclude

Posted by Niclas Hedhman <ni...@hedhman.org>.
Bruno Dumon said:
> The XInclude transformer depends on the setDocumentLocator() SAX
> event for getting the base location in case there is no xml:base
> attribute. If you simply have a FileGenerator with after that the
> XInclude
> transformer, everything should work well. But maybe your problem
> is caused by using another generator, or by using a transformer
> before the XInclude transformer which doesn't let through the
> setDocumentLocator event.

Hmmm... It is a bit difficult, as Forrest adds a "forest" of stuff
that I don't follow.

The bottom line is;

1. Command-line executed Forrest correctly resolves the relative
href in XInclude.
2. Mounting Forrest in a web application, the relative href becomes
relative to the mount point, and not relative to the includer
document.

Now, perhaps you think I should deal with Forrest and not Cocoon,
but I am rather sure it is more Cocoon related.


I'll try to produce a "Out-of-the-Box" Forrest Testcase.


Cheers,
Niclas



Re: XInclude

Posted by Bruno Dumon <br...@outerthought.org>.
On Mon, 2003-08-25 at 13:15, Joerg Heinicke wrote:
> Bruno, who implemented the new XInclude stuff, is/was on vacation AFAIK. 

I'm back now ;-)

> Why not simply filing a bug?

agreed, and preferably with some more information, see below...

> 
> Niclas Hedhman wrote:
> > Niclas Hedhman said:
> > 
> >><xinclude:include href="abc.xml" />
> >>
> >> does not behave correctly. The xml:base is set to the top-level
> >>directory, i.e. content/, and not to the same directory as the
> >>including document as the spec says.
> >>Setting the xml:base attribute to the current directory, absolute
> >>or relative to the content/, works but is not a solution.

The XInclude transformer depends on the setDocumentLocator() SAX event
for getting the base location in case there is no xml:base attribute. If
you simply have a FileGenerator with after that the XInclude
transformer, everything should work well. But maybe your problem is
caused by using another generator, or by using a transformer before the
XInclude transformer which doesn't let through the setDocumentLocator
event.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: XInclude

Posted by Joerg Heinicke <jh...@virbus.de>.
Bruno, who implemented the new XInclude stuff, is/was on vacation AFAIK. 
Why not simply filing a bug?

Joerg

Niclas Hedhman wrote:
> Niclas Hedhman said:
> 
>><xinclude:include href="abc.xml" />
>>
>> does not behave correctly. The xml:base is set to the top-level
>>directory, i.e. content/, and not to the same directory as the
>>including document as the spec says.
>>Setting the xml:base attribute to the current directory, absolute
>>or relative to the content/, works but is not a solution.
> 
> 
> 
> Maybe I wasn't clear.
> 
> 1. If I have my own sub-sitemap in the default Forrest environment,
> and running command-line tools, the above doesn't resolve correctly.
> 
> 2. If I define the documents as Forrest types, and let Forrest
> provide the resolution, it resolves OK from the command-line.
> 
> 3. If I take the whole setup that works from the command-line and
> deploy it live under Jetty, the xinclude again have the xml:base set
> to the top level.
> 
> something is utterly wrong. Am I the only one who like Xinclude?
> 
> Niclas


Re: XInclude

Posted by Niclas Hedhman <ni...@hedhman.org>.
Niclas Hedhman said:
> <xinclude:include href="abc.xml" />
>
>  does not behave correctly. The xml:base is set to the top-level
> directory, i.e. content/, and not to the same directory as the
> including document as the spec says.
> Setting the xml:base attribute to the current directory, absolute
> or relative to the content/, works but is not a solution.


Maybe I wasn't clear.

1. If I have my own sub-sitemap in the default Forrest environment,
and running command-line tools, the above doesn't resolve correctly.

2. If I define the documents as Forrest types, and let Forrest
provide the resolution, it resolves OK from the command-line.

3. If I take the whole setup that works from the command-line and
deploy it live under Jetty, the xinclude again have the xml:base set
to the top level.

something is utterly wrong. Am I the only one who like Xinclude?

Niclas