Page Flow: Dynamic navigation with Matcher

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Page Flow: Dynamic navigation with Matcher

fl.schmitt(ops-users)
Hi,

i'm trying to configure my page-flow to dynamically select the model and view depending on the output of a XPL. One way to do this seems to use pattern matching. But i can't get it working. My page flow contains:


        <page id="validate" path-info="/validate">
                <action action="pages/mail/validate-model.xpl">
                        <result when="/result/@action" page="makeMail" />
                        <result when="true()" page="summary" />
                </action>
        </page>
        <page id="makeMail" path-info="/makeMail"
                matcher="oxf:perl5-matcher"
                model="pages/mail/${1}-model.xpl"
                view="pages/mail/${1}-view.html">
                <setvalue ref="/result/@action" matcher-group="1" />
        </page>

In the first step (id="validate"), a xml doc is validated and the result is written as a attribute (@action) into the root element (result). This step is working, as debugging shows.

In the second step (id="makeMail"), the content of /result/@action should be used to select the model and view. This step doesn't work. I get an OF error page with the message "Cannot load "/pages/mail/${1}-view.html" with webapp loader". Obviously, the URL "/pages/mail/${1}-view.html" isn't rewritten to "/pages/mail/<<content of /result/@action>>-view.html". What am i doing wrong?

Thanks in advance
florian
Reply | Threaded
Open this post in threaded view
|

Re: Page Flow: Dynamic navigation with Matcher

Alessandro Vernet
Administrator
Florian,

On 8/16/07, florianschmitt <[hidden email]> wrote:
>         <page id="makeMail" path-info="/makeMail"
>                 matcher="oxf:perl5-matcher"
>                 model="pages/mail/${1}-model.xpl"
>                 view="pages/mail/${1}-view.html">
>                 <setvalue ref="/result/@action" matcher-group="1" />
>         </page>

You would like to do what is described in section 5.4 of the page flow
documentation; is this right?

http://www.orbeon.com/ops/doc/reference-page-flow

I think that what you are missing here is the piece that passes the
instance from "validate" to "makeMail". If you look a the example in
section 5.4, you can see that the instance passed is inside the
"result" element.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Page Flow: Dynamic navigation with Matcher

fl.schmitt(ops-users)
Hi Alex,

in the meantime, i've implemented a solution without matching (testing
in the result@when and calling different pages) - but it would be more
"elegant" to use matching. So i tried your recommendation.

> You would like to do what is described in section 5.4 of the page flow
> documentation; is this right?
>
> http://www.orbeon.com/ops/doc/reference-page-flow

Precisely :-)

> I think that what you are missing here is the piece that passes the
> instance from "validate" to "makeMail". If you look a the example in
> section 5.4, you can see that the instance passed is inside the
> "result" element.

At the beginning, i thought that this is because there's no other source
for a xml submission in the example, like an action XPL. In the
meantime, i realized that the result of an action XPL as well must be
included in the result element. So i did, but it still doesn't work. My
page flow now looks as follows:

<page id="validate" path-info="/validate">
     <action action="pages/mail/validate-model.xpl">
         <result when="/result/@action"
                 page="makeMailMatch"
                 transform="oxf:xslt"
                 trace="test" >
             <form xsl:version="2.0"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                 <xsl:copy-of select="doc('input:action')"/>
             </form>
         </result>
         <result when="true()" page="summary" />
     </action>
</page>
<page id="makeMailMatch"
       path-info="/makeMailMatch"
       matcher="oxf:perl5-matcher"
       model="pages/mail/${1}-model.xpl"
       view="pages/mail/${1}-view.html">
     <setvalue ref="//@action" matcher-group="1"/>
</page>

The log shows that the result doc is created properly (with action
attribute and appropriate content) and that the makeMailMatch page is
called. But still the ${1} isn't replaced by the setvalue instruction
(same error - Cannot load "/pages/mail/${1}-view.html" with webapp loader).

The example in the documentation has some regex in the path-info, too.
Is this required to trigger the pattern matching and replacement?

florian

PS: Found out that my posting
http://www.nabble.com/Re%3A-eclipse-plugin-p12124839.html wasn't new,
there's aready a description at
http://www.nabble.com/Re%3A-Eclipse-page-flow.xml-validation-p8893302.html 
- sorry for double-posting!




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Page Flow: Dynamic navigation with Matcher

Alessandro Vernet
Administrator
Florian,

On 8/17/07, Florian Schmitt <[hidden email]> wrote:
> The log shows that the result doc is created properly (with action
> attribute and appropriate content) and that the makeMailMatch page is
> called. But still the ${1} isn't replaced by the setvalue instruction
> (same error - Cannot load "/pages/mail/${1}-view.html" with webapp loader).

Would it be possible for you to create an "app" that we can deploy
under the apps directory and that shows this behavior?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws