I understand: you need the id in order to generate your XForms mode.

You can mimic what the WAC does by using the request and perl5-matcher processors:

    <p:processor uri="oxf/processor/request">
        <p:input name="config">
            <config>
                <include>/request/request-path</include>
            </config>
        </p:input>
        <p:output name="data" id="request-path"/>
    </p:processor>

    <p:processor uri="oxf/processor/perl5-matcher">
        <p:input name="data" href="#request-path"/>
        <p:input name="config"><regexp>^.*/([^/]*)$</regexp></p:input>
        <p:output name="data" id="regexp-result"/>
    </p:processor>

Your id will be available as #regexp-result#xpointer(/result/group[1]).

You can of course adapt the regular expression to suit your particular need.

-Erik

Justin Makeig wrote:

I don't think I phrased my question correctly. Here goes version 2.0:

I've got a page whose url is something like, http://server/app/edit/73 where
the "73" is the ID of the document (timesheets, in this case) that's stored
in the database.  Each timesheet has different start and end dates. Thus,
the XForms model needed to edit a timesheet must be generated dynamically
(i.e. a matrix with projects on one axis and days on the other axis). Right
now, the XForms pipeline parses the URL using the request generator.
However, I thought that using the RegExp matcher in the controller was a
much more elegant and powerful solution (XSLT's string parsing is awful). Is
there a way it can be used for XForms generation rather than just for the
model?

- Justin

On 10/6/03 9:29 AM, "Erik Bruchez" <[EMAIL PROTECTED]> wrote:


The example below will work whether your XForms model is static or dynamically
generated, as long as you provide the "/form/book-id" element in the model.

-Erik

Justin Makeig wrote:


What if I'm building the XForms dynamically and need to send a param to the
xforms pipeline? Is there a way to do this?

Justin

--
Product Manager
Center for Document Engineering
http://cde.berkeley.edu/
University of California, Berkeley
[EMAIL PROTECTED]



On 9/30/03 9:01 PM, "Erik Bruchez" <[EMAIL PROTECTED]> wrote:



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


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

Reply via email to