You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2002/03/19 06:57:37 UTC

sitemap urlencoding subst patch

in a c2 project i'm working on, we're using the request parameter matcher
to match values that we then use in the generator's source url:

<map:match pattern="nlm/query">
  <map:match type="request" pattern="author">
    <map:generate src="http://www.ncbi.nlm.nih.gov/entrez/utils/pmqty.fcgi?db=PubMed&amp;mode=XML&amp;dispmax=999&amp;term={1}[au]"/>
    <map:serialize/>
  </map:match>
</map:match>

problem was, the request parameter could contain spaces and other fun
characters, and the value wasn't being urlencoded. i've attached a patch
for the sitemap which adds urlencoding to the subst method, but i don't
know that that's appropriate for all cases. can y'all think of anything
this would break?

- donald

RE: sitemap urlencoding subst patch

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Donald Ball [mailto:balld@webslingerZ.com]
> 
> On Tue, 19 Mar 2002, Vadim Gritsenko wrote:
> 
> > If I'm not mistaken, this will break match like:
> >
> > <map:generate
> >
src="{1}/{2}?db=PubMed&amp;mode=XML&amp;dispmax=999&amp;term={3}[au]"/>
> >
> > Where
> > {1} = http://www.ncbi.nlm.nih.gov
> > {2} = entrez/utils/pmqty.fcgi
> 
> bet you it would too. okay, then, any suggestions for a better way to
> patch this?  maybe add encode() as a "function" in the subst engine?
or is
> there a better way to refactor this?
 
URLEncodeAction? :)

Vadim

> - donald


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


RE: sitemap urlencoding subst patch

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 19 Mar 2002, Vadim Gritsenko wrote:

> If I'm not mistaken, this will break match like:
>
> <map:generate
> src="{1}/{2}?db=PubMed&amp;mode=XML&amp;dispmax=999&amp;term={3}[au]"/>
>
> Where
> {1} = http://www.ncbi.nlm.nih.gov
> {2} = entrez/utils/pmqty.fcgi

bet you it would too. okay, then, any suggestions for a better way to
patch this?  maybe add encode() as a "function" in the subst engine? or is
there a better way to refactor this?

- donald


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


RE: sitemap urlencoding subst patch

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Donald Ball [mailto:balld@webslingerZ.com]
> 
> in a c2 project i'm working on, we're using the request parameter
matcher
> to match values that we then use in the generator's source url:
> 
> <map:match pattern="nlm/query">
>   <map:match type="request" pattern="author">
>     <map:generate
>
src="http://www.ncbi.nlm.nih.gov/entrez/utils/pmqty.fcgi?db=PubMed&amp;m
ode=XM
> L&amp;dispmax=999&amp;term={1}[au]"/>
>     <map:serialize/>
>   </map:match>
> </map:match>
> 
> problem was, the request parameter could contain spaces and other fun
> characters, and the value wasn't being urlencoded. i've attached a
patch
> for the sitemap which adds urlencoding to the subst method, but i
don't
> know that that's appropriate for all cases. can y'all think of
anything
> this would break?

If I'm not mistaken, this will break match like:

<map:generate
src="{1}/{2}?db=PubMed&amp;mode=XML&amp;dispmax=999&amp;term={3}[au]"/>

Where 
{1} = http://www.ncbi.nlm.nih.gov
{2} = entrez/utils/pmqty.fcgi

Vadim


> - donald


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