You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicolas Delahaye <ni...@imediation.com> on 2000/03/20 18:12:26 UTC
[cocoon2][sitemap] multiple filters problem
Hi,
I need to create a sitemap that uses two xsl filters as: xml files --
Xslt process --> xml -- Xslt process --> html.
I try to define :
<cocoon version="2.0">
<component role="parser"
class="org.apache.cocoon.components.parser.XercesParser"/>
<generator name="file"
class="org.apache.cocoon.generators.FileGenerator"/>
<filter name="xslt"
class="org.apache.cocoon.filters.XalanFilter"/>
<filter name="uri"
class="org.apache.cocoon.filters.XalanFilter"/>
<serializer name="xml"
class="org.apache.cocoon.serializers.XMLSerializer"/>
<serializer name="html"
class="org.apache.cocoon.serializers.HTMLSerializer"/>
<sitemap>
<partition>
<process uri="**.xml" source="**.xml">
<generator name="file"/>
<filter name="uri">
<parameter name="stylesheet"
value="first.xsl"/>
</filter>
<filter name="xslt">
<parameter name="stylesheet"
value="second.xsl"/>
</filter>
<serializer name="html">
<parameter name="contentType"
value="text/html"/>
</serializer>
</process>
</partition>
</sitemap>
</cocoon>
Why the last filter is the only one applied ? Can we apply more than
one filter with Cocoon 2 ?
Best Regards
Nicolas Delahaye
Re: [cocoon2][sitemap] multiple filters problem
Posted by Sebastien Sahuc <ss...@imediation.com>.
> In the current alpha distribution of Cocoon2, there is a Bug in the
> way Filters are processed : The filters are treated in the exact
> reverse order in wich they've been declared in the Sitemap.
Indeed the filters are set consumers and producers in the wrong order
in the GenericProcessor.process(). The diff follows :
Index: ./src/org/apache/cocoon/sitemap/GenericProcessor.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Generi
cProcessor.java,v
retrieving revision 1.1.2.8
diff -r1.1.2.8 GenericProcessor.java
146c146
< for (int x=0; x<this.filters.size(); x++) {
---
> for (int x=(this.filters.size()-1); x>=0; x--) {
164c164
<
---
>
Sebastien
Re: [cocoon2][sitemap] multiple filters problem
Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Sebastien Sahuc wrote:
>
> Stefano Mazzocchi wrote :
>
> > > Can we apply more than one filter with Cocoon 2 ?
>
> > If you can't, it's a bug. the functionality _needs_ to be there.
>
> In the current alpha distribution of Cocoon2, there is a Bug in the
> way Filters are processed : The filters are treated in the exact
> reverse order in wich they've been declared in the Sitemap.
SHIT :(
Sorry... I thought it was fixed in the CVS... I noticed it while flying
out to ApacheCON...
Pier (who lost the ApacheCON modifications :( )
--
----------------------------------------------------------------------
pier: stable structure erected over water to allow docking of seacraft
<ma...@betaversion.org> <http://www.betaversion.org/~pier/>
----------------------------------------------------------------------
Re: [cocoon2][sitemap] multiple filters problem
Posted by Sebastien Sahuc <ss...@imediation.com>.
Stefano Mazzocchi wrote :
> > Can we apply more than one filter with Cocoon 2 ?
> If you can't, it's a bug. the functionality _needs_ to be there.
In the current alpha distribution of Cocoon2, there is a Bug in the
way Filters are processed : The filters are treated in the exact
reverse order in wich they've been declared in the Sitemap.
For exemple, suppose the following sitemap :
[..] <!-- conf and sitemap details \>
<process uri="**.xml" source="**.xml">
<generator name="file"/>
<!-- 1st stylesheet -->
<filter name="xslt">
<parameter name="stylesheet"
value="samples/stylesheets/style1.xsl"/>
</filter>
<!-- 2nd stylesheet -->
<filter name="xslt">
<parameter name="stylesheet"
value="samples/stylesheets/style2.xsl"/>
</filter>
<!-- 3rd stylesheet -->
<filter name="xslt">
<parameter name="stylesheet"
value="samples/stylesheets/style3.xsl"/>
</filter>
[...]
Then the SAX stream will first be processed by the THIRD style sheet,
then by the SECOND one, and finally by the First.
I'll try to have a look on that,
Sebastien
PS : Cocoon2 is definitely the way to go, I feel its power :-)
Re: [cocoon2][sitemap] multiple filters problem
Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Stefano Mazzocchi wrote:
>
> > Can we apply more than one filter with Cocoon 2 ?
>
> If you can't, it's a bug. the functionality _needs_ to be there.
It _IS_ there... I used it for my ApacheCON presentation...
If it is not, I have not updated something in the CVS :(
My fault..
Pier
--
----------------------------------------------------------------------
pier: stable structure erected over water to allow docking of seacraft
<ma...@betaversion.org> <http://www.betaversion.org/~pier/>
----------------------------------------------------------------------
Re: [cocoon2][sitemap] multiple filters problem
Posted by Stefano Mazzocchi <st...@apache.org>.
Nicolas Delahaye wrote:
>
> Hi,
>
> I need to create a sitemap that uses two xsl filters as: xml files --
> Xslt process --> xml -- Xslt process --> html.
> I try to define :
>
> <cocoon version="2.0">
> <component role="parser"
> class="org.apache.cocoon.components.parser.XercesParser"/>
>
> <generator name="file"
> class="org.apache.cocoon.generators.FileGenerator"/>
>
> <filter name="xslt"
> class="org.apache.cocoon.filters.XalanFilter"/>
> <filter name="uri"
> class="org.apache.cocoon.filters.XalanFilter"/>
>
> <serializer name="xml"
> class="org.apache.cocoon.serializers.XMLSerializer"/>
> <serializer name="html"
> class="org.apache.cocoon.serializers.HTMLSerializer"/>
>
> <sitemap>
> <partition>
> <process uri="**.xml" source="**.xml">
> <generator name="file"/>
> <filter name="uri">
> <parameter name="stylesheet"
> value="first.xsl"/>
> </filter>
> <filter name="xslt">
> <parameter name="stylesheet"
> value="second.xsl"/>
> </filter>
> <serializer name="html">
> <parameter name="contentType"
> value="text/html"/>
> </serializer>
> </process>
> </partition>
> </sitemap>
> </cocoon>
>
> Why the last filter is the only one applied ?
You are using two XSLT filters so you should indicate so. I would do
<filter name="xslt">
<parameter name="stylesheet" value="first.xsl"/>
</filter>
<filter name="xslt">
<parameter name="stylesheet" value="second.xsl"/>
</filter>
> Can we apply more than one filter with Cocoon 2 ?
If you can't, it's a bug. the functionality _needs_ to be there.
NOTE: since may clients normally break the lines at 72 cols, please, use
a 1 char tab when indenting your XML or make sure that you don't break
at 72 otherwise the whole thing is a mess to read (look above)
--
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 ---------------------