You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de> on 2002/05/01 00:05:19 UTC

Re: {0} sitemap parameter in regexp matcher

On 30.Apr.2002 -- 04:54 PM, Artur Bialecki wrote:
> 
> Is {0} not available when using sitemap matcher?
> I have a sub-sitemap where
> 
> This works (wildcard):
> 
>    <map:match 
>      pattern="product/category_edit.xml">
>      <map:act type="update-ejb">
>        <map:generate type="serverpages" src="{../0}"/>
>      </map:act>
>      <map:transform type="xinclude"/> 
>      <map:transform src="product/category.xsl"/>
>      <map:serialize/>
>    </map:match>
> 
> but this doesn't (regexp):
> 
>    <map:match type="regexp"
>      pattern="product/category_(view|edit)\.xml">
>      <map:act type="update-entity">
>        <map:generate type="serverpages" src="{../0}"/>
>      </map:act>
>      <map:transform type="xinclude"/> 
>      <map:transform src="product/category.xsl"/>
>      <map:serialize/>
>    </map:match>
> 
> to make the generator find source I have to do:
> src="product/category_{../1}.xml"
> 
> Any ideas ?

It's not available. 1, 2, ... refer to the 1st, 2nd, ... parenthesis. So
enclosing everything with () would make the complete match available. Not
sure whether that would be 1 or 2, though. But it should be printed out
in your sitemap log ;-)

If so desired (and agreed), it would be trivial to add 0 to
AbstractRegexpMatcher.

after line 127 add:
   map.put("0", match);

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: {0} sitemap parameter in regexp matcher

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 30.Apr.2002 -- 09:20 PM, Vadim Gritsenko wrote:
> > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> > 
> > On 30.Apr.2002 -- 06:33 PM, Artur Bialecki wrote:
> > >
> > > > -----Original Message-----
> > > > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> > > > Sent: Tuesday, April 30, 2002 6:05 PM
> > >
> > > >> but this doesn't (regexp):
> > > >>
> > > >>    <map:match type="regexp"
> > > >>      pattern="product/category_(view|edit)\.xml">
> > > >>      <map:act type="update-entity">
> > > >>        <map:generate type="serverpages" src="{../0}"/>
> > > >>      </map:act>
> > > >>      <map:transform type="xinclude"/>
> > > >>      <map:transform src="product/category.xsl"/>
> > > >>      <map:serialize/>
> > > >>    </map:match>
> > >
> > > > If so desired (and agreed), it would be trivial to add 0 to
> > > > AbstractRegexpMatcher.
> > > >
> > > > after line 127 add:
> > > >    map.put("0", match);
> > > >
> > >
> > > This would make it more consistent with wildcard matcher and
> > > help poor saps like me with move from C1 to C2.
> > > Maybe this should be a general rule for all matchers that
> > > parameter {0} is allways the whole matched pattern.
> > >
> > > What is the best way to get this fixed? Bugzilla?
> > 
> > I'd like to hear a comment from another developer on this since it's
> > not strictly a regexp. OTOH is 0 as backreference not defined.
> 
> getParen(0) in regexp defined as whole matched string, but not whole
> pattern
> (http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html):

done. 'twas even simpler: start loop from 0 instead of 1 :-)

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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


RE: {0} sitemap parameter in regexp matcher

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> 
> On 30.Apr.2002 -- 06:33 PM, Artur Bialecki wrote:
> >
> > > -----Original Message-----
> > > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> > > Sent: Tuesday, April 30, 2002 6:05 PM
> >
> > >> but this doesn't (regexp):
> > >>
> > >>    <map:match type="regexp"
> > >>      pattern="product/category_(view|edit)\.xml">
> > >>      <map:act type="update-entity">
> > >>        <map:generate type="serverpages" src="{../0}"/>
> > >>      </map:act>
> > >>      <map:transform type="xinclude"/>
> > >>      <map:transform src="product/category.xsl"/>
> > >>      <map:serialize/>
> > >>    </map:match>
> >
> > > If so desired (and agreed), it would be trivial to add 0 to
> > > AbstractRegexpMatcher.
> > >
> > > after line 127 add:
> > >    map.put("0", match);
> > >
> >
> > This would make it more consistent with wildcard matcher and
> > help poor saps like me with move from C1 to C2.
> > Maybe this should be a general rule for all matchers that
> > parameter {0} is allways the whole matched pattern.
> >
> > What is the best way to get this fixed? Bugzilla?
> 
> I'd like to hear a comment from another developer on this since it's
> not strictly a regexp. OTOH is 0 as backreference not defined.

getParen(0) in regexp defined as whole matched string, but not whole
pattern
(http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html):

RE r = new RE("(a*)b");                  // Compile expression
boolean matched = r.match("xaaaab");     // Match against "xaaaab"
String wholeExpr = r.getParen(0);        // wholeExpr will be 'aaaab'



Also it makes some sense to have whole pattern somehow available in the
map.

Vadim


> Apart from that I'll take care of it ;-)
> 
> 	Chris.
> 
> --
> C h r i s t i a n       H a u l
> haul@informatik.tu-darmstadt.de
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


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


Re: {0} sitemap parameter in regexp matcher

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 30.Apr.2002 -- 06:33 PM, Artur Bialecki wrote:
> 
> > -----Original Message-----
> > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> > Sent: Tuesday, April 30, 2002 6:05 PM
> 
> >> but this doesn't (regexp):
> >> 
> >>    <map:match type="regexp"
> >>      pattern="product/category_(view|edit)\.xml">
> >>      <map:act type="update-entity">
> >>        <map:generate type="serverpages" src="{../0}"/>
> >>      </map:act>
> >>      <map:transform type="xinclude"/> 
> >>      <map:transform src="product/category.xsl"/>
> >>      <map:serialize/>
> >>    </map:match>
> 
> > If so desired (and agreed), it would be trivial to add 0 to
> > AbstractRegexpMatcher.
> > 
> > after line 127 add:
> >    map.put("0", match);
> > 
> 
> This would make it more consistent with wildcard matcher and
> help poor saps like me with move from C1 to C2.
> Maybe this should be a general rule for all matchers that
> parameter {0} is allways the whole matched pattern.
> 
> What is the best way to get this fixed? Bugzilla?

I'd like to hear a comment from another developer on this since it's
not strictly a regexp. OTOH is 0 as backreference not defined.

Apart from that I'll take care of it ;-)

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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


RE: {0} sitemap parameter in regexp matcher

Posted by Artur Bialecki <ar...@digitalfairway.com>.
> -----Original Message-----
> From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> Sent: Tuesday, April 30, 2002 6:05 PM

>> but this doesn't (regexp):
>> 
>>    <map:match type="regexp"
>>      pattern="product/category_(view|edit)\.xml">
>>      <map:act type="update-entity">
>>        <map:generate type="serverpages" src="{../0}"/>
>>      </map:act>
>>      <map:transform type="xinclude"/> 
>>      <map:transform src="product/category.xsl"/>
>>      <map:serialize/>
>>    </map:match>

> If so desired (and agreed), it would be trivial to add 0 to
> AbstractRegexpMatcher.
> 
> after line 127 add:
>    map.put("0", match);
> 

This would make it more consistent with wildcard matcher and
help poor saps like me with move from C1 to C2.
Maybe this should be a general rule for all matchers that
parameter {0} is allways the whole matched pattern.

What is the best way to get this fixed? Bugzilla?

Thanks,

Artur...


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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: {0} sitemap parameter in regexp matcher

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> 
> On 30.Apr.2002 -- 04:54 PM, Artur Bialecki wrote:
> >
> > Is {0} not available when using sitemap matcher?
> > I have a sub-sitemap where
> >
> > This works (wildcard):
> >
> >    <map:match
> >      pattern="product/category_edit.xml">
> >      <map:act type="update-ejb">
> >        <map:generate type="serverpages" src="{../0}"/>
> >      </map:act>
> >      <map:transform type="xinclude"/>
> >      <map:transform src="product/category.xsl"/>
> >      <map:serialize/>
> >    </map:match>
> >
> > but this doesn't (regexp):
> >
> >    <map:match type="regexp"
> >      pattern="product/category_(view|edit)\.xml">
> >      <map:act type="update-entity">
> >        <map:generate type="serverpages" src="{../0}"/>
> >      </map:act>
> >      <map:transform type="xinclude"/>
> >      <map:transform src="product/category.xsl"/>
> >      <map:serialize/>
> >    </map:match>
> >
> > to make the generator find source I have to do:
> > src="product/category_{../1}.xml"
> >
> > Any ideas ?
> 
> It's not available. 1, 2, ... refer to the 1st, 2nd, ... parenthesis.
So
> enclosing everything with () would make the complete match available.
Not
> sure whether that would be 1 or 2, though. But it should be printed
out

It will be 1, 'cause that's the first parenthesis.

Vadim


> in your sitemap log ;-)
> 
> If so desired (and agreed), it would be trivial to add 0 to
> AbstractRegexpMatcher.
> 
> after line 127 add:
>    map.put("0", match);
> 
> 	Chris.
> 
> --
> C h r i s t i a n       H a u l
> haul@informatik.tu-darmstadt.de
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: {0} sitemap parameter in regexp matcher

Posted by Artur Bialecki <ar...@digitalfairway.com>.
> -----Original Message-----
> From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> Sent: Tuesday, April 30, 2002 6:05 PM

>> but this doesn't (regexp):
>> 
>>    <map:match type="regexp"
>>      pattern="product/category_(view|edit)\.xml">
>>      <map:act type="update-entity">
>>        <map:generate type="serverpages" src="{../0}"/>
>>      </map:act>
>>      <map:transform type="xinclude"/> 
>>      <map:transform src="product/category.xsl"/>
>>      <map:serialize/>
>>    </map:match>

> If so desired (and agreed), it would be trivial to add 0 to
> AbstractRegexpMatcher.
> 
> after line 127 add:
>    map.put("0", match);
> 

This would make it more consistent with wildcard matcher and
help poor saps like me with move from C1 to C2.
Maybe this should be a general rule for all matchers that
parameter {0} is allways the whole matched pattern.

What is the best way to get this fixed? Bugzilla?

Thanks,

Artur...


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