cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yann" <ylelo...@ims.ltd.uk>
Subject Re: XSP + XML
Date Fri, 28 Jul 2000 12:51:02 GMT
> My purpose is to select data to display according to an external event. I
> mean, I could have in my xml file all the products of my company and
during
> the afternoon only display the product labelled "soap" (description or/and
> picture). Maybe, it's not the aim of Cocoon, I just start....but it's the
> aim of my boss.

You misunderstand me. What you want to achieve is indeed the purpose of
Cocoon. What I meant is that I don't think one should put "presentation
logic" (i.e. how it looks like) within the "business logic" (i.e. what data
do we retrieve).

All you have to do is to put some Java code within the XSP page that will
filter what data to retrieve. For instance, somewhere in your XSP:

<xsp:logic>
    if (itIsTheAfternoon()) {
        <xsp:content>
            <soaps>
                <soap>
                    ...
                <soap>
            <soaps>
        </xsp:content>
    } else {
        <xsp:content>
            <booze>
                <redbull/>
                <vodka/>
            <booze>
    }
</xsp:logic>

Then in your XSL file:

    <xsl:template match="soaps">
        // do the rendering for soaps
    </xsl:template>

    <xsl:template match="booze">
        // do the rendering for booze (hey I like redbull & vodka)
    </xsl:template>


Do you see what I mean?

Yann.


Mime
View raw message