You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stuart Roebuck <sr...@adolos.com> on 2000/07/17 09:47:38 UTC

C2: Relative URLs in output vs.

I've been looking at the <sitemap> and considering issues relating to  
Cocoon 2 based websites.  One big issue that I can't see an obvious  
solution to (but that doesn't mean there isn't one :-) ) relates to the  
<transformer> based generation of relative links to web based resources  
from pages which can be mapped into different spaces in resulting site  
hierarchy.

e.g. {

You create a site using Cocoon 2.

You put your standard image files in a subdirectory called "images".

You start with an index page "index.html" at the root of your site.

You auto-generate standard parts of each page using a transform which,  
amongst other things, creates relative links to a background image used on  
every page.  The relative link to this image is "images/background.gif".

As the site expands, you add extra pages, including some news pages,  
generated by some files called "news/*.xml" and mapped to and called,  
"somenews.html" and "someothernews.html" (at the root directory).   
Everything works fine.

Then you decide you need to organise things better because you've got all  
your pages mapped onto the root directory and run into potential name  
conflicts, so you change the <sitemap> and map your news pages onto  
"news/*.html".

Suddenly, all your backgrounds disappear, because the links to the  
background are added by a single XSLT transformer that doesn't know that  
the absolute address of the pages it is transforming are different.

As far as I am aware, you can't do the checking you would need to fix this  
because it would use XSP which is a generator not a transformer.

}

Any thoughts on this.

Stuart.

Re: C2: Relative URLs in output vs.

Posted by Stefano Mazzocchi <st...@apache.org>.
Donald Ball wrote:
> 
> On Tue, 18 Jul 2000, Stefano Mazzocchi wrote:
> 
> > why? do people enter your side by typing
> >
> >  http://www.yoursite.com
> 
> yes.
> 
> > or they do directly
> >
> >  http://www.yoursite.com/index.html
> 
> also, yes.
> 
> > Do not underestimate the impact of such decision: using a "default file
> > for indexes" is a hack that Apache turned into a design patter. But it's
> > still a hack. A pretty big one as well!
> 
> what are you talking about?? default file indexes predate apache and are
> quite useful. i hate it when my designers link straight to /index.html,
> i've had to beat it into them to link to / instead.

That's what I mean: Apache enforced a hack to become the rule. Now
people are accustomed to that so much that they believe the two above
resources are _necessarely_ the same.

But this is not the case.

What do you do if the server is a IIS? Do you try

 http://www.yoursite.com/default.htm

And if Cocoon1 you try

 http://www.yoursite.com/index.xml

and so on.

So, you _have_ to beat your content writers (designers in Cocoon don't
create links!!!) when they link directly to the file instead of the
resource.

Sure, Cocoon changes the picture so much your content writers will have
to be "trained" on this new URI idea, but it's cleaner and safer, so
shouldn't be a problem.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: C2: Relative URLs in output vs.

Posted by Stefano Mazzocchi <st...@apache.org>.
Niclas Hedhman wrote:
> 
> Mark Washeim wrote:
> 
> > I agree with donald. there is nothing hack-like about resolving a directory
> > reference to an index document. That's a feature :)
> 
> Something that Stefano otherwise would call a Resource Reference!!

Yes.

There is nothing wrong in resource redirection. This is correct.

But it *IS* wrong to assume there is *always* a resource redirection
between 

 path/ -> path/index.html

This is what I'm talking about and Donalds seems to agree with me since
he gets mad when people assume this.

Cocoon2 will just make this much more evident.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: C2: Relative URLs in output vs.

Posted by Niclas Hedhman <ni...@localbar.com>.
Mark Washeim wrote:

> I agree with donald. there is nothing hack-like about resolving a directory
> reference to an index document. That's a feature :)

Something that Stefano otherwise would call a Resource Reference!!

Niclas


Re: C2: Relative URLs in output vs.

Posted by Mark Washeim <31...@t-online.de>.
on 18/7/00 11:45 pm, Donald Ball at balld@webslingerZ.com wrote:

> On Tue, 18 Jul 2000, Stefano Mazzocchi wrote:
> 
>> why? do people enter your side by typing
>> 
>> http://www.yoursite.com
> 
> yes.
> 
>> or they do directly
>> 
>> http://www.yoursite.com/index.html
> 
> also, yes.
> 
>> Do not underestimate the impact of such decision: using a "default file
>> for indexes" is a hack that Apache turned into a design patter. But it's
>> still a hack. A pretty big one as well!
> 
> what are you talking about?? default file indexes predate apache and are
> quite useful. i hate it when my designers link straight to /index.html,
> i've had to beat it into them to link to / instead.
> 
> - donald
> 

I agree with donald. there is nothing hack-like about resolving a directory
reference to an index document. That's a feature :)

-- 
Mark (Poetaster) Washeim

'On the linen wrappings of certain mummified remains
found near the Etrurian coast are invaluable writings
that await translation.

Quem colorem habet sapientia?'

Evan S. Connell

 



Re: C2: Relative URLs in output vs.

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 18 Jul 2000, Stefano Mazzocchi wrote:

> why? do people enter your side by typing
> 
>  http://www.yoursite.com

yes.

> or they do directly
> 
>  http://www.yoursite.com/index.html

also, yes.

> Do not underestimate the impact of such decision: using a "default file
> for indexes" is a hack that Apache turned into a design patter. But it's
> still a hack. A pretty big one as well!

what are you talking about?? default file indexes predate apache and are
quite useful. i hate it when my designers link straight to /index.html,
i've had to beat it into them to link to / instead.

- donald


Re: C2: Relative URLs in output vs.

Posted by Stefano Mazzocchi <st...@apache.org>.
Stuart Roebuck wrote:
> 
> I've been looking at the <sitemap> and considering issues relating to
> Cocoon 2 based websites.  One big issue that I can't see an obvious
> solution to (but that doesn't mean there isn't one :-) ) relates to the
> <transformer> based generation of relative links to web based resources
> from pages which can be mapped into different spaces in resulting site
> hierarchy.

hmmmm...
 
> e.g. {
> 
> You create a site using Cocoon 2.

Ok, I already like this :)
 
> You put your standard image files in a subdirectory called "images".

Fair enough.
 
> You start with an index page "index.html" at the root of your site.

why? do people enter your side by typing

 http://www.yoursite.com

or they do directly

 http://www.yoursite.com/index.html

Do not underestimate the impact of such decision: using a "default file
for indexes" is a hack that Apache turned into a design patter. But it's
still a hack. A pretty big one as well!

To me, something like

 http://www.yoursite.com/index

is a much better entry point. And

 http://www.yoursite.com/index.html

will be called if the user wants to "force" you to return HTML (and only
that!) to him/her.
 
> You auto-generate standard parts of each page using a transform which,
> amongst other things, creates relative links to a background image used on
> every page.  The relative link to this image is "images/background.gif".
> 
> As the site expands, you add extra pages, including some news pages,
> generated by some files called "news/*.xml" and mapped to and called,
> "somenews.html" and "someothernews.html" (at the root directory).
> Everything works fine.

[I know this was not your point and I'm being annoyinly picky, but URI
space design is really important] 

Same as above: you should not use extentions in your URI space unless
you "really" mean it.
 
> Then you decide you need to organise things better because you've got all
> your pages mapped onto the root directory and run into potential name
> conflicts, so you change the <sitemap> and map your news pages onto
> "news/*.html".
> 
> Suddenly, all your backgrounds disappear, because the links to the
> background are added by a single XSLT transformer that doesn't know that
> the absolute address of the pages it is transforming are different.
>
> As far as I am aware, you can't do the checking you would need to fix this
> because it would use XSP which is a generator not a transformer.

Have you thought about using sitemap internal redirection capabilities?

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------