Carsten Ziegeler wrote:
Sylvain Wallez wrote:
Why are relative files resolved relative to the context and not to the location of the cocoon.xconf?
Good question :-)
At first, I thought relative URIs should be relative to the current file,
Yepp, that was my thought as well.
> but then looked at how sourceresolving is done everywhere else in
Cocoon: URIs are relative to the current sitemap (i.e. the context in case of the root sitemap): "src" attributes in the sitemap, includes in CInclude and XInclude, etc. AFAIK, only XSLT's includes and imports are handled differently because it's mandated by the XSLT spec.Confusing :) It's not a big deal, but without thinking - as a dumb user (and I'm very good in acting like someone who can't think at all) - I
So, I decided to use the standard sourceresolving mechanism in xconf also.
How does that sound?
would expect that a relative path in the cocoon.xconf is resolved relative to the cocoon.xconf like it happens with paths in the sitemap.
Not exactly: paths in the sitemap are relative to the sitemap location because this is the location that defines the local context. Now if you consider e.g. a file in "subdir/blah.xml" that has a <cinclude:include src="foo.xml"/>, then that "foo.xml" will be resolved relative to the sitemap location (i.e. the local context) and not relative to "subdir".
That's why I chose this way or resolving relative URIs.
The cocoon.xconf is the core configuration for cocoon, so when it is consulted there is no sitemap.
Yes, but there is a context, which is the same than the one used for the root sitemap ;-)
If you use the include (of components) in a sitemap, then I assume that it is resolved relative to the location of this sitemap and not to the context.
I see a misunderstanding: "context" (or "local context") is not to be confused with "root context". When loading the root cocoon.xconf, the local context is the root context. When loading a sitemap, the local context is the sitemap location and any <include> in <map:component> will use that local context.
So, to summarize, <include> uses the local context (either root context or sitemap location), but not the configuration file's location.
How does that sound to a dumb user? ;-)
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
