Accessing a xform variable within my xpl model

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

Accessing a xform variable within my xpl model

ldavis
Hi,
I am very new to orbeon and all this so I apologise if I am asking a question that has been asked a million time over, or happens to be in bold of page 1 in the manual.


I have a very basic example consisting of two pages. It allows the user to enter a name of someone they are looking for and then stores this in the xform model that I have defined, under first-name. I have an xpl file which I want to make a call to my ejb passing in the name of the person that was entered. To do this I am trying to pass in the value that I have stored in my xfrom model. However when I try to do this I can?t retrieve the value from the xfrom model and so the query to the ejb fails.

The following is a walk though of the code I am using. Any help that anyone can offer me would be very much appreciated.
Many thanks,
Leon

My xform looks as follows:
xform:
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
    <xforms:instance>
        <glue-personel-form>
                        <action />
                        <first-name/>
        </glue-personel-form>
    </xforms:instance>
</xforms:model>

The user then clicks find and then a call to an EJB is made looking for the name that has been entered.

find-person.xhtml:
<xforms:group>
  <xhtml:p>
     Please enter the name of the person you wish to find:
     <xforms:input ref="/glue-personel-form/first-name"/>
       <xforms:submit>
          <xforms:label>Find!</xforms:label>
            <xforms:setvalue ref="/glue-personel-form/action">next</xforms:setvalue>
       </xforms:submit>
  </xhtml:p>
</xforms:group>

The page-flow acts on the next instruction and goes to the employee-record page.

page-flow.xml:
<action when="/glue-personel-form/action = 'next'"  action="employee-record-query.xpl">
  <result page="employee-record">
     <xu:update select="/glue-personel-form/first-name">
       <xu:value-of select="doc('input:instance')/glue-personel-form/first-name"/>
     </xu:update>
  </result>
</action>

employee-record-query.xpl:
<p:processor name="oxf:delegation">  
  <p:input name="interface">  
    <config>  
      <service id="find-employee" type="stateless-ejb" uri="ejb/personSessionEJBR"/>
    </config>
  </p:input>

  <p:input name="call">
    <result>
      <delegation:execute service="find-employee" operation="getPersonRecord">
        <name xsi:type="xs:string"><xsl:value-of select="/glue-personel-form/first-name"/></name>
      </delegation:execute>
    </result>
  </p:input>
  <p:output name="data" id="result"/>
</p:processor>



--
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: Accessing a xform variable within my xpl model

Ryan Puddephatt
Leon,
        With this method you need to have an XML file holding details of
your instance throughout your pages as show in this example
http://www.orbeon.com/ops/goto-example/xforms-wizard-pfc

Although you could use a submission to send the data to the XPL, which you
could display on the same page!

<submission ref="instance('id-of-instance')" id="Post-Data"
        Method="post" action="page-flow/to/xpl"
        Replace="instance" instance="output-instance"/>

The problem with your XPL is that you are trying to use XSL in the
delegation processor, you should do the following

<p:processor name="oxf:xslt-2.0">
        <p:input name="data" href="#instance"/>
        <p:input name="config>

        <xsl:stylesheet xmlns:xsl="http://www.w3.org/2003/XSL/Transform"
version="2.0">
                       
        <xsl:template match="/">
        <result>
        <delegation:execute
        service="find-employee" operation="getPersonRecord">

      <name xsi:type="xs:string">
        <xsl:value-of select="/glue-personel-form/first-name"/>
        </name>
      </delegation:execute>
    </result>
        </xsl:template>
        </xsl:stylesheet>
</p:input>
<p:output name="data" id="result"/>

The input in your delegation should now be

<p:input name="call" href="#result"/>

Hope this helps

Ryan Puddephatt
Web Developer
TFX Group
1 Michaelson Square
Livingston
West Lothian
Scotand
EH54 7DP
 
* [hidden email]
( 01506 407 110
7  01506 407 108
 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: 07 November 2005 12:14
To: [hidden email]
Subject: [ops-users] Accessing a xform variable within my xpl model

Hi,
I am very new to orbeon and all this so I apologise if I am asking a
question that has been asked a million time over, or happens to be in bold
of page 1 in the manual.


I have a very basic example consisting of two pages. It allows the user to
enter a name of someone they are looking for and then stores this in the
xform model that I have defined, under first-name. I have an xpl file which
I want to make a call to my ejb passing in the name of the person that was
entered. To do this I am trying to pass in the value that I have stored in
my xfrom model. However when I try to do this I cant retrieve the value
from the xfrom model and so the query to the ejb fails.

The following is a walk though of the code I am using. Any help that anyone
can offer me would be very much appreciated.
Many thanks,
Leon

My xform looks as follows:
xform:
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
    <xforms:instance>
        <glue-personel-form>
                        <action />
                        <first-name/>
        </glue-personel-form>
    </xforms:instance>
</xforms:model>

The user then clicks find and then a call to an EJB is made looking for the
name that has been entered.

find-person.xhtml:
<xforms:group>
  <xhtml:p>
     Please enter the name of the person you wish to find:
     <xforms:input ref="/glue-personel-form/first-name"/>
       <xforms:submit>
          <xforms:label>Find!</xforms:label>
            <xforms:setvalue
ref="/glue-personel-form/action">next</xforms:setvalue>
       </xforms:submit>
  </xhtml:p>
</xforms:group>

The page-flow acts on the next instruction and goes to the employee-record
page.

page-flow.xml:
<action when="/glue-personel-form/action = 'next'"
action="employee-record-query.xpl">
  <result page="employee-record">
     <xu:update select="/glue-personel-form/first-name">
       <xu:value-of
select="doc('input:instance')/glue-personel-form/first-name"/>
     </xu:update>
  </result>
</action>

employee-record-query.xpl:
<p:processor name="oxf:delegation">  
  <p:input name="interface">  
    <config>  
      <service id="find-employee" type="stateless-ejb"
uri="ejb/personSessionEJBR"/>
    </config>
  </p:input>

  <p:input name="call">
    <result>
      <delegation:execute service="find-employee"
operation="getPersonRecord">
        <name xsi:type="xs:string"><xsl:value-of
select="/glue-personel-form/first-name"/></name>
      </delegation:execute>
    </result>
  </p:input>
  <p:output name="data" id="result"/>
</p:processor>





--
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: Accessing a xform variable within my xpl model

Erik Bruchez
Administrator
In reply to this post by ldavis
Leon,

You are using an xsl:value-of within your Delegation processor "call"
input. This won't do anything. If you want to dynamically generate
your call input document, then you must use before that an XSLT
processor to generate your "call" document, something like:

<p:processor name="oxf:xslt">
     <p:input name="data" href="#instance"/>
     <p:input name="config">
        <delegation:execute service="find-employee"
operation="getPersonRecord">
          <name xsi:type="xs:string"><xsl:value-of
select="/glue-personel-form/first-name"/></name>
        </delegation:execute>
     </p:input>
     <p:output name="data" id="call"/>
</p:processor>

<p:processor name="oxf:delegation">
    <p:input name="interface">
      <config>
        <service id="find-employee" type="stateless-ejb"
uri="ejb/personSessionEJBR"/>
      </config>
     </p:input>
     <p:input name="data"><dummy/></p:input>
     <p:input name="call" href="#call"/>
     <p:output name="data" id="result"/>
</p:processor>

-Erik

[hidden email] wrote:
 > Hi,

 > I am very new to orbeon and all this so I apologise if I am asking a
 > question that has been asked a million time over, or happens to be
 > in bold of page 1 in the manual.
 >
 >
 > I have a very basic example consisting of two pages. It allows the
 > user to enter a name of someone they are looking for and then stores
 > this in the xform model that I have defined, under first-name. I
 > have an xpl file which I want to make a call to my ejb passing in
 > the name of the person that was entered. To do this I am trying to
 > pass in the value that I have stored in my xfrom model. However when
 > I try to do this I can$(Bt (Bretrieve the value from the xfrom
model and
 > so the query to the ejb fails.

 > The following is a walk though of the code I am using. Any help that
 > anyone can offer me would be very much appreciated.

 > Many thanks,
 > Leon
 >
 > My xform looks as follows:
 > xform:
 > <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
 >     <xforms:instance>
 >         <glue-personel-form>
 > <action />
 > <first-name/>
 >         </glue-personel-form>
 >     </xforms:instance>
 > </xforms:model>
 >
 > The user then clicks find and then a call to an EJB is made looking
for the name that has been entered.
 >
 > find-person.xhtml:
 > <xforms:group>
 >   <xhtml:p>
 >      Please enter the name of the person you wish to find:
 >      <xforms:input ref="/glue-personel-form/first-name"/>
 >        <xforms:submit>
 >           <xforms:label>Find!</xforms:label>
 >             <xforms:setvalue
ref="/glue-personel-form/action">next</xforms:setvalue>
 >        </xforms:submit>
 >   </xhtml:p>
 > </xforms:group>
 >
 > The page-flow acts on the next instruction and goes to the
employee-record page.
 >
 > page-flow.xml:
 > <action when="/glue-personel-form/action = 'next'"
action="employee-record-query.xpl">
 >   <result page="employee-record">
 >      <xu:update select="/glue-personel-form/first-name">
 >        <xu:value-of
select="doc('input:instance')/glue-personel-form/first-name"/>
 >      </xu:update>
 >   </result>
 > </action>
 >
 > employee-record-query.xpl:
 > <p:processor name="oxf:delegation">
 >   <p:input name="interface">
 >     <config>
 >       <service id="find-employee" type="stateless-ejb"
uri="ejb/personSessionEJBR"/>
 >     </config>
 >   </p:input>
 >
 >   <p:input name="call">
 >     <result>
 >       <delegation:execute service="find-employee"
operation="getPersonRecord">
 >         <name xsi:type="xs:string"><xsl:value-of
select="/glue-personel-form/first-name"/></name>
 >       </delegation:execute>
 >     </result>
 >   </p:input>
 >   <p:output name="data" id="result"/>
 > </p:processor>




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