Hi Robert,

you could write your own custom transformer. That is *much* faster than using XSLT. 
Take a look at 

http://wiki.cocoondev.org/Wiki.jsp?page=ImplementingTransformers

to get started.

I was thinking about doing something similar. The basic idea is to use a list of 
"symbolic names" for URIs (e.g. in a simple .properties file):

home=/index.html
search.user.form=/search/user_search.html
search.user.action=/search/user_search.action
search.company.form=/search/company_search.html
search.company.action=/search/company_search.action
...

Inside of the pages I would replace all links like that:

<a href="{home}">Home</a>
<a href="{search.company.form}">Search for a company</a>
<form action="{search.user.action}">
    Enter a user name:
    <input type="text"
    ...
</form>

Transformer implementation shouldn´t be too complicated: Look at each attribute of the 
incoming XML/SAX and replace the {}-strings inside attributes. I guess the performance 
should also be okay.
This transformer could be put at the end of each pipeline. So that would allow all 
other components (XSP, XML, Transformers) to use only the "symbolic names" instead of 
the URI. This has the additional advantage, that you could assert referential 
integrity, i.e. broken links are very easy to find and fix.

Until now I didn´t have the time to implement this, because it has a rather low 
priority for our project, sorry :-( 

It´s just an idea. It may be stupid. Comments welcome.

-Jan

--------------------------------
Dipl. Inf. Jan Harms
Software Developer

VIVAI Software AG
Königswall 1
44137 Dortmund
Germany

email   harms_at_vivai.de
url     http://www.vivai.de
 

> -----Ursprüngliche Nachricht-----
> Von: Robert Sösemann [mailto:[EMAIL PROTECTED]]
> Gesendet: Samstag, 1. Februar 2003 16:10
> An: [EMAIL PROTECTED]
> Betreff: Re: mapping to basepath in static content
> 
> 
> Yes, thank you, it's better than nothing. But I need to 
> replace URL in scr,
> value, action ... attributes as well. Sometimes even in 
> javascript commands.
> I tried to write my own xsl, but then it really gets very slow.
> 
> Any idea.
> 
> Robert
> ----- Original Message -----
> From: "Murad Jura" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 01, 2003 1:15 PM
> Subject: Re: mapping to basepath in static content
> 
> 
> > Hello Robert,
> >
> > there is the AugmentTransformer which augments all 'href' attributes
> > with the full path to the request. IMHO it is a good 
> starting point for
> you.
> >
> > Regards,
> > Murad Jura.
> >
> > Robert Sösemann wrote:
> > > Hello,
> > >
> > > what I need is a centralized mechanism to change the 
> paths in all my
> > > site-elements. (that means: Later when I switsch from 
> development to
> > > production I just want to change pathname at one single 
> point, not every
> > > single href, src ...)
> > >
> > > Inside elements handled by cocoon (XSP, Generators, 
> Action) thats no
> > > problem, because they know their own context. Things I 
> later add in my
> > > Transformers are also no problem. I use xsl:include to 
> set a variable in
> > > very other xsl.
> > >
> > > BUT: I also use static html or xhtml pages. How can change path
> attributes
> > > an even javascript command in a similar centralized way?
> > >
> > > Who can help? Maybe I am on a totally wrong way.
> > >
> > > Rob
> > >
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to