cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Anderson <benanderson...@gmail.com>
Subject XQueryTransformer
Date Tue, 15 Mar 2005 19:12:46 GMT
Hi,
For anyone using exist w/ cocoon... I'm attaching an XQueryTransformer
which can be used in place of the XQueryGenerator.  Besides leaving
the precious gerenator spot available, another advantage is that you
can use request parameters with multiple values...

The tranformer is setup in the sitemap.xmap:
  <map:transformers>
      <map:transformer name="xquery"
                       src="org.exist.cocoon.XQueryTransformer">
        <collection>@exist.uri@/db</collection>
        <user>@exist.user@</user>
        <password>@exist.pass@</password>
        <create-session>false</create-session>
        <expand-xincludes>false</expand-xincludes>

expects a document like this:
<xqtr:xquery src="xquery/1.xq">
  <xqtr:parameter name="team" value="Steelers"/>
  <xqtr:parameter name="nothingHere"/>
  <xqtr:parameter name="players">
    <xqtr:value>Greg</xqtr:value>
    <xqtr:value>Lloyd</xqtr:value>
  </xqtr:parameter>
</xqtr:xquery>

All optional parameters must appear in the list.  The transformer
returns the result of the xquery file referenced by the src attribute.
 There are certain things I left out that appear in the
XQueryGenerator, because I simply didn't need them.  So it may need
some additional work, depending on your needs.
-Ben

Mime
View raw message