cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solprovi...@apache.org
Subject Re: Cocoon 2.2: Accessing resources (images, css)
Date Wed, 26 Mar 2008 11:11:15 GMT
On 3/26/08, Magnus Haraldsen Amundsen
<Magnus.Haraldsen.Amundsen@computas.com> wrote:
> We have a web app where the images and stylesheets are defined in the
> pipeline as this:
> <map:match pattern="images/*.gif">
>   <map:read src="resources/images/{1}.gif" mime-type="image/gif"/>
> </map:match>
>
> In our XSLT we use the following syntax to display the images:
> <img alt="header logo" src="images/header.gif"/>
>
> And this works just fine when the url is like this:
> http://www.example.com/myapp
>
> However, when the url look like this:
> http://www.example.com/myapp/admin
> The images and stylesheets aren't accessed. How can this be solved?
>
> Both the example URLs use the same XSLT to be transformed.
> - Magnus

Research the difference between absolute and relative URLs on
webpages.  You can find good material in tutorials about writing HTML.

http://www.example.com/myapp + images/header.gif =
http://www.example.com/images/header.gif [FOUND]

http://www.example.com/myapp/admin + images/header.gif =
http://www.example.com/myapp/images/header.gif [NOT FOUND]

The easy answer is always use absolute URLs (which start with a slash):
<img src="/images/header.gif"/>

http://www.example.com/myapp + /images/header.gif =
http://www.example.com/images/header.gif [FOUND]

http://www.example.com/myapp/admin + /images/header.gif =
http://www.example.com/images/header.gif [FOUND]

Just adding the leading slash should solve your issue.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message