cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett McLaughlin <bmcla...@algx.net>
Subject Re: Sitemap and Links...
Date Fri, 31 Dec 1999 02:35:21 GMT


Pierpaolo Fumagalli wrote:
> 
> Ben Laurie wrote:
> >
> > There's a problem with ambiguity here. Since you use the translation
> > both ways, it could be impossible to work out the URL from the "source",
> > which you need to do your URL translation magic below (that is, if two
> > URLs map to the same source file but with different filters, then you
> > are sunk).
> 
> Very true... We didn't think to this one... (in other words, thanks for
> the hint :)
> 
> I was thinking about "translating" uris in the same area, and, if a
> match wasn't found, then looking again into the sitemap (top-down) to
> resolve the link, but I must agree that is not a feasible solution.
> Let's examine this example:
> 
> <sitemap>
>   <process uri="flowers/*.html" translate="*.xml">
>     <producer name="file"/>
>     <processor name="xslt">
>       <param name="stylesheet" value="flowers.xsl"/>
>     <processor>
>     <serializer name="html"/>
> 
>   <process uri="diamonds/*.html" translate="*.xml">
>     <producer name="file"/>
>     <processor name="xslt">
>       <param name="stylesheet" value="diamonds.xsl"/>
>     <processor>
>     <serializer name="html"/>
> 
>   <process uri="flowers/xsp/*.html" translate="*.xsp">
>     <producer name="xsp"/>
>     <processor name="xslt">
>       <param name="stylesheet" value="flowers.xsl"/>
>     <processor>
>     <serializer name="html"/>
> 
>   <process uri="diamonds/xsp/*.html" translate="*.xsp">
>     <producer name="xsp"/>
>     <processor name="xslt">
>       <param name="stylesheet" value="diamonds.xsl"/>
>     <processor>
>     <serializer name="html"/>
> </sitemap>
> 
> Using that algorithm, in fact, if I have a link to "doc.xml" in an xsp
> called "test.xsp", from both areas ("/flowers/xsp/test.html", or
> "/diamonds/xsp/test.html"), I would be always linked to
> "/flowers/doc.html" because the target of the link is not present in the
> same area, and so the first one is always matched.

I must misunderstand you here.  How would a link to doc.xml be
translated at all?  There is nothing in your sitemap that specifies
processing of *.xml, and certainly nothing that maps it to *.html, which
is what this implies.  So I assume you meant the reverse: doc.html is
the link target, which gets translated to doc.xml by the sitemap.

I think the larger issue is not so much pattern matching... your example
implies that if a document is not found where specified (in this case,
the same directory you are in, since no absolute or relative path is
given, just "doc.html") the document is searched for in other areas.  I
strongly disagree with this.  A sitemap is for grouping of translations
and processing, not to allow you to be stupid and put documents in any
place and have Cocoon figure out where they are.  It seems you would
have either:

(in /flowers/xsp/test.html)

<a href="doc.html">Link</a>
	* which would generate an error, 500 Not Found, if doc.xml is not in
/flowers/xsp (which is the translation rule)

OR

<a href="/flowers/doc.html">Link</a>
	* which would map to doc.xml in /flowers, which is correct

OR

<a href="/diamonds/doc.html">Link</a>
	* which would map to doc.xml in /diamonds, which is correct.

I can never see a good reason to have doc.xml in /flowers, but have it
matched with:

<a href="doc.xml">No good</a>

if the referrer is in /diamonds/xsp, for example.  Or am I missing the
point entirely?

-Brett



> 
> A "quick dirty" solution would be specifying (again in the sitemap) a
> "context" for URL translation (context="flowers" in the first and third
> area and context="diamonds" in the second and the fourth), but I don't
> like it, since it adds a lot of complexity, and it could be very hard to
> debug...
> 
> Does anyone have another possible solution (HELP HELP!!!! :)
> 
> Also, we might want to force the user to select a "context" (imagine
> something like:
> ...
>   View document with <link href="doc.xml">current stylesheet</link>
>   <link href="doc.xml" ?????>or with another one </link>
> ...
> 
>         Pier (dubious...)

Mime
View raw message