Great example. Note that when using XForms, you can also tell the Web App Controller to put request parameters into your XForms instance, given a match on a regular expression. For example:

<page path-info="/books/(.*)" matcher="oxf/processor/perl5-matcher"
       xforms="oxf:/form/book.xml"
       model="oxf:/model/books.xpl"
       view="oxf:/page/books.xsl">
    <param ref="/form/book-id"/>
</page>

With a setup like this, when an URL of the form /books/123 is requested, /form/book-id will be set to "123". This is a good way of using parts of your URL as parameters without using the request generator.

-Erik

Dung wrote:

Hi, I'm starting to play with OXF. As this subject may interest all
beginners, I'll just give this more commented example :
Hope it will help (see the comment within the code)
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline";> <p:param type="output" name="data"/>
<!--
we catch the received parameter which follows
this schema :
<request>
<parameters>
<parameter>
<name>name_of_the_parameter</name>
<value>value_of_the_parameter</value>
</parameter>
</parameters>
</request -->
<p:processor uri="oxf/processor/request">
<p:input name="config">
<config>
<include>/request/parameters</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>
<!--
referencing the "request" output, we test it :
depending on the parameter name ("local" or
"external"), the right processor is called to aggregate the path of the
xml file to be sent as "document" output for next processor to
make xslt transformation
example :
http://localhost:8080/magiccv?local=cv_0000001.xml
or
http://localhost:8080/magiccv?external=http://my-server.com/cv_0000002.x
ml
-->
<p:choose href="#request"
xmlns:p="http://www.orbeon.com/oxf/pipeline";>
<p:when
test="/request/parameters/parameter/name='local'">
<p:processor
uri="oxf/processor/url-generator">
<p:input name="config"
href="aggregate('config', #request#xpointer(concat('oxf:',
/request/parameters/parameter[name='local']/value)))" />
<p:output name="data" id="document"
/>
</p:processor>
</p:when> <p:when
test="/request/parameters/parameter/name='external'">
<p:processor
uri="oxf/processor/url-generator">
<p:input name="config"
href="aggregate('config', #request#xpointer(concat('',
/request/parameters/parameter[name='external']/value)))" />
<p:output name="data" id="document"
/>
</p:processor>
</p:when>
</p:choose> <!--
this processor will make the xslt transformation
to the xml document, taking the preceding example, the input xml will be
:
oxf:cv_0000001.xml
or
http://my-server.com/cv_0000002.xml
-->
<p:processor uri="oxf/processor/xslt"> <p:input name="data" href="#document" />
<p:input name="config" href="magiccv.xsl" />
<p:output name="data" ref="data"/> </p:processor>
</p:config>



------------------------------------------------------------------------


_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users


_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users

Reply via email to