You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Beauprez Sven <Sv...@the-ecorp.com> on 2001/06/12 11:33:36 UTC

changing flow depending on SAX event

Hi,

We are using the SQLTransformer to query a DB. Input parameters for the
query come from the request (via parameters in the sitemap, for this i have
made some changes to the SQLTransformer, which i'll post as soon as i
documented it).
Depending on the result of the query, we want to change the flow in the
sitemap:
(x := nr of rows)
x==0: redirect to errorpage
x==1: redirect immediately to another page with this result
x>1: let the user choose and go to another page

You can say that the above description of the problem also contains the
solution: use redirect on the client. But this is not what we want
(performance). We want to change the flow as soon as we know the result (eg.
nr of rows) from the DB.
Following example shows how we see a possible solution (we know that it
doesn't work, it is just to illustrate what we want to do)
pre: nrOfRows has been put in request object by a transformer

          <map:select type="parameter">
            <map:parameter name="request-selector-test" value="nrOfRows"/>
            <map:when test="0">
              <map:redirect-to uri="error/noResults"/>
            </map:when>
            <map:when test="1">
              <map:act type="RequestParameter">
                <map:parameter name="X" value=""/>
                <map:parameter name="Y" value=""/>
                <map:redirect-to uri="page.xml?X={X}&amp;Y={Y}"/>
              </map:act>
            </map:when>
            <map:otherwise>
              <map:transform type="xslt"
src="stylesheets/{../1}/stylesheet.xsl">
                <map:parameter name="Z" value="{Z}"/>
              </map:transform>
            </map:otherwise>
          </map:select>

Has someone an idea how to do this, taking the cocoon-philosophy into
account?


Sven

---------------------------------------------------------------------
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>