Simple xpath question

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

Simple xpath question

Chris Bailey-2
Hi,

I have what I hope is a simple xpath question. I want to combine the
contents of several text nodes to form a space separated list (so that
later I can pass it to a xforms:select control).

<xforms:instance id="books">
        <books xmlns="">
                <book>
                        <author>Adam</author>
                </book>
                <book>
                        <author>Jones</author>
                </book>
        </books>
</xforms:instance>

<xforms:instance id="control">
        <data xmlns="">
                <authors/>
        </data>
</xforms:instance>

I would like to bind the control instance to list all the authors.
e.g.
<xforms:bind nodeset="instance('control')/authors"
calculate="instance('books')//author"/>

However if I do this I only get the first item
<xforms:instance id="control">
        <data xmlns="">
                <authors>Adam</authors>
        </data>
</xforms:instance>

What I want is:
<authors>Adam Jones</authors>

I tried calculate="data(instance('books')//author)" but it still gives
me the same answer.
How can I achieve this?

Regards,
Chris.



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Simple xpath question

Hank Ratzesberger

Hi Chris,

How about:

  calculate="string-join( instance('books')//author, ' ' )

(you may need author/text() )

Cheers,
Hank

On Aug 18, 2008, at 3:25 AM, Chris Bailey wrote:

> Hi,
>
> I have what I hope is a simple xpath question. I want to combine  
> the contents of several text nodes to form a space separated list  
> (so that later I can pass it to a xforms:select control).
>
> <xforms:instance id="books">
> <books xmlns="">
> <book>
> <author>Adam</author>
> </book>
> <book>
> <author>Jones</author>
> </book>
> </books>
> </xforms:instance>
>
> <xforms:instance id="control">
> <data xmlns="">
> <authors/>
> </data>
> </xforms:instance>
>
> I would like to bind the control instance to list all the authors.
> e.g.
> <xforms:bind nodeset="instance('control')/authors"  
> calculate="instance('books')//author"/>
>
> However if I do this I only get the first item
> <xforms:instance id="control">
> <data xmlns="">
> <authors>Adam</authors>
> </data>
> </xforms:instance>
>
> What I want is:
> <authors>Adam Jones</authors>
>
> I tried calculate="data(instance('books')//author)" but it still  
> gives me the same answer.
> How can I achieve this?
>
> Regards,
> Chris.
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Simple xpath question

Chris Bailey-2
Many thanks Hank,

That's exactly what I was looking for.

Chris.

Hank Ratzesberger wrote:

>
> Hi Chris,
>
> How about:
>
>  calculate="string-join( instance('books')//author, ' ' )
>
> (you may need author/text() )
>
> Cheers,
> Hank
>
> On Aug 18, 2008, at 3:25 AM, Chris Bailey wrote:
>
>> Hi,
>>
>> I have what I hope is a simple xpath question. I want to combine the
>> contents of several text nodes to form a space separated list (so that
>> later I can pass it to a xforms:select control).
>>
>> <xforms:instance id="books">
>>     <books xmlns="">
>>         <book>
>>             <author>Adam</author>
>>         </book>
>>         <book>
>>             <author>Jones</author>
>>         </book>
>>     </books>
>> </xforms:instance>
>>
>> <xforms:instance id="control">
>>     <data xmlns="">
>>         <authors/>
>>     </data>
>> </xforms:instance>  
>>
>> I would like to bind the control instance to list all the authors.
>> e.g.
>> <xforms:bind nodeset="instance('control')/authors"
>> calculate="instance('books')//author"/>
>>
>> However if I do this I only get the first item
>> <xforms:instance id="control">
>>     <data xmlns="">
>>         <authors>Adam</authors>
>>     </data>
>> </xforms:instance>  
>>
>> What I want is:
>> <authors>Adam Jones</authors>
>>
>> I tried calculate="data(instance('books')//author)" but it still gives
>> me the same answer.
>> How can I achieve this?
>>
>> Regards,
>> Chris.
>>
>>
>> --
>> 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> Hank Ratzesberger
> NEES@UCSB
> Institute for Crustal Studies,
> University of California, Santa Barbara
> 805-893-8042
>
>
>
>
>


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

problem of submitting from a created form to jsp page

Surendran M-2
In reply to this post by Chris Bailey-2
Hi

Is it possible to send the data from the created form to another jsp present
at a certain location





--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Need Example of automatically populating fields

Betty Harvey

I have a codelist that I am using to automatically populate values
in another XML file:

<CodeList>
   <Row>
      <Value1>1</Value1>
      <Value2>2</Value2>
      ..
   </Row>
...
</CodeList>

<MyInstance>
  ...
<A>
  <B>
  <C>
  ...
</A>
...
</MyInstance>

Value1 in the codelist is the dropdown for the user to select a value.
When they select the value I want the rest of the values from the Codelist
populate the tree.

I have been able to accomplish this by putting a trigger and
having the user hit save but I want this to be done 'under the covers'.

I have tried binding the values but that doesn't work, placing a 'setvalue'
in the submission, etc. but nothing seems to work.

This seems like a common requirement but my searches have taken me down
dead-end roads.

TIA!

Betty

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
Electronic Commerce Connection, Inc. |
[hidden email]                    | Washington,DC SGML/XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
Help Mac fight MLD (http://www.macsteam.org)
Mark your calendar for October 28th (http://www.macsteam.org/BullROast.aspx)


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: problem of submitting from a created form to jsp page

Erik Bruchez
Administrator
In reply to this post by Surendran M-2
> Is it possible to send the data from the created form to another jsp  
> present
> at a certain location


Are you talking about Form Runner here?

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: problem of submitting from a created form to jsp page

Surendran M-2
Regarding form builder

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]]
Sent: Saturday, August 30, 2008 3:07 AM
To: [hidden email]
Subject: [ops-users] Re: problem of submitting from a created form to jsp
page

> Is it possible to send the data from the created form to another jsp  
> present
> at a certain location


Are you talking about Form Runner here?

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Need Example of automatically populating fields

Alessandro Vernet
Administrator
In reply to this post by Betty Harvey
Hi Betty,

On Fri, Aug 29, 2008 at 6:06 AM, Betty Harvey <[hidden email]> wrote:
> Value1 in the codelist is the dropdown for the user to select a value.
> When they select the value I want the rest of the values from the Codelist
> populate the tree.
>
> I have been able to accomplish this by putting a trigger and
> having the user hit save but I want this to be done 'under the covers'.

I am not sure I understand exactly what you mean by "populate the tree",
but if you have an action (or sequence of actions) that run upon
DOMActivate on a trigger, you should be able to run the same sequence
upon xforms-value-changed on the drop-down, so it runs right away as
soon as a value is selected. Does this help in your case?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Need Example of automatically populating fields

Betty Harvey
I am able to populate using a trigger but I want the values to dynamically
be populated from another instance (code list) without user interaction.

This seems like a very simple concept that I am just not getting.

For example this output statment works great getting a value based
on an input in the form.  As soon as a selection is made the values
are dynamically show on the form:

<xforms:output
ref="instance('Container-instance')/Row/Width[../ContainerDescription =
$containerDescription]"/>

I would think that the setvalue can be used like to the <xforms:output>
statement to populate the XML instance.

<xforms:setvalue ref="era:ContainerDimensions/era:Height"
value="instance('Container-instance')/Row/Width[../ContainerDescription =
$containerDescription ]" ev:event="DOMActivate"/>

I have tried embedding the setvalue in an <action> statement but the
only thing that seems to work is having user interaction to set the
value.

I am thinking that it might be easier just to write an XSLT to populate
this type of information when the form is submitted.

Thanks!

Betty


<quote who="Alessandro Vernet">

> Hi Betty,
>
> On Fri, Aug 29, 2008 at 6:06 AM, Betty Harvey <[hidden email]> wrote:
>> Value1 in the codelist is the dropdown for the user to select a value.
>> When they select the value I want the rest of the values from the
>> Codelist
>> populate the tree.
>>
>> I have been able to accomplish this by putting a trigger and
>> having the user hit save but I want this to be done 'under the covers'.
>
> I am not sure I understand exactly what you mean by "populate the tree",
> but if you have an action (or sequence of actions) that run upon
> DOMActivate on a trigger, you should be able to run the same sequence
> upon xforms-value-changed on the drop-down, so it runs right away as
> soon as a value is selected. Does this help in your case?
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> Orbeon's Blog: http://www.orbeon.com/blog/
> Personal Blog: http://avernet.blogspot.com/
> Twitter - http://twitter.com/avernet
>
>

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
Electronic Commerce Connection, Inc. |
[hidden email]                    | Washington,DC SGML/XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
Help Mac fight MLD (http://www.macsteam.org)
Mark your calendar for October 28th (http://www.macsteam.org/BullROast.aspx)


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Need Example of automatically populating fields

Alessandro Vernet
Administrator
On Wed, Sep 3, 2008 at 6:51 AM, Betty Harvey <[hidden email]> wrote:
> I am able to populate using a trigger but I want the values to dynamically
> be populated from another instance (code list) without user interaction.

So if I understand this correctly, you would like to do this before the
form is sent to the browser. If that is the case, you can add an
<xforms:action ev:event="xforms-model-construct-done"> inside the
<xforms:model>. Inside this action, you can perform the
<xforms:setvalue> that populate one instance based on the content of
another instance.

Sometimes XSLT can be another way to do the same thing. We have been
using XSLT in the past even more heavily than we do now (if you can
believe that!), but in general we are trying to limit the number of XSLT
transformations needed to generate a page, for performance reasons. It
also makes things simpler architecturally if you can look at your pages
as "just XForms calling REST services".

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Need Example of automatically populating fields

Betty Harvey
It is the other way around.  I want to populate the XML before it gets
sent to the database.  I have a code list that has the following fields:

    <Row>
        <ContainerCode>AER-A</ContainerCode>
         <ContainerDescription>Aerial Film Can,
Standard</ContainerDescription>
         <Depth>5.5</Depth>
         <Width>5.5</Width>
         <Height>10</Height>
         <TotalCubicFoot>10</TotalCubicFoot>
      </Row>

The code list is used to populate another XML structure:

 <ContainerInformation>
            <Container>
                <ContainerType/>
                <ContainerDimensions>
                    <Height/>
                    <Width/>
                    <Depth/>
                </ContainerDimensions>
                <Quantity/>
             </Container>
  </ContainerInformation>

The user selected the <ContainerDescription> then the dimensions
should be populated from the source code.  In XSLT this is
trivial that is why I am thinking I am missing a key concept.

I would prefer to do this in XForms because I am trying to see how
far we can go with XForms as a 'proof of concept' without using
other technologies, i.e. XSLT, JScript, etc.

Thanks!

Betty

<quote who="Alessandro Vernet">

> On Wed, Sep 3, 2008 at 6:51 AM, Betty Harvey <[hidden email]> wrote:
>> I am able to populate using a trigger but I want the values to
>> dynamically
>> be populated from another instance (code list) without user interaction.
>
> So if I understand this correctly, you would like to do this before the
> form is sent to the browser. If that is the case, you can add an
> <xforms:action ev:event="xforms-model-construct-done"> inside the
> <xforms:model>. Inside this action, you can perform the
> <xforms:setvalue> that populate one instance based on the content of
> another instance.
>
> Sometimes XSLT can be another way to do the same thing. We have been
> using XSLT in the past even more heavily than we do now (if you can
> believe that!), but in general we are trying to limit the number of XSLT
> transformations needed to generate a page, for performance reasons. It
> also makes things simpler architecturally if you can look at your pages
> as "just XForms calling REST services".
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> Orbeon's Blog: http://www.orbeon.com/blog/
> Personal Blog: http://avernet.blogspot.com/
> Twitter - http://twitter.com/avernet
>
>

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
Electronic Commerce Connection, Inc. |
[hidden email]                    | Washington,DC SGML/XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
Help Mac fight MLD (http://www.macsteam.org)
Mark your calendar for October 28th (http://www.macsteam.org/BullROast.aspx)


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Need Example of automatically populating fields

Erik Bruchez
Administrator
I am sure you can do "this" in XForms, but the issue is for members of  
this list is to understand exactly what "this" is ;-)

You say you would like this to run "without user interaction". I am  
not sure what this means: surely you would like to do this at a  
certain point, right? In XForms, action handlers run upon listening to  
certain events. There are several events in XForms I can think of that  
could be used, including xforms-value-changed and xforms-submit, but  
it would help if you could first be more precise as to when you would  
like this to happen.

Also maybe if you could send an example that can run in the sandbox,  
that would help.

-Erik

On Sep 3, 2008, at 4:06 PM, Betty Harvey wrote:

> It is the other way around.  I want to populate the XML before it gets
> sent to the database.  I have a code list that has the following  
> fields:
>
>    <Row>
>        <ContainerCode>AER-A</ContainerCode>
>         <ContainerDescription>Aerial Film Can,
> Standard</ContainerDescription>
>         <Depth>5.5</Depth>
>         <Width>5.5</Width>
>         <Height>10</Height>
>         <TotalCubicFoot>10</TotalCubicFoot>
>      </Row>
>
> The code list is used to populate another XML structure:
>
> <ContainerInformation>
>            <Container>
>                <ContainerType/>
>                <ContainerDimensions>
>                    <Height/>
>                    <Width/>
>                    <Depth/>
>                </ContainerDimensions>
>                <Quantity/>
>             </Container>
>  </ContainerInformation>
>
> The user selected the <ContainerDescription> then the dimensions
> should be populated from the source code.  In XSLT this is
> trivial that is why I am thinking I am missing a key concept.
>
> I would prefer to do this in XForms because I am trying to see how
> far we can go with XForms as a 'proof of concept' without using
> other technologies, i.e. XSLT, JScript, etc.
>
> Thanks!
>
> Betty
>
> <quote who="Alessandro Vernet">
>> On Wed, Sep 3, 2008 at 6:51 AM, Betty Harvey <[hidden email]>  
>> wrote:
>>> I am able to populate using a trigger but I want the values to
>>> dynamically
>>> be populated from another instance (code list) without user  
>>> interaction.
>>
>> So if I understand this correctly, you would like to do this before  
>> the
>> form is sent to the browser. If that is the case, you can add an
>> <xforms:action ev:event="xforms-model-construct-done"> inside the
>> <xforms:model>. Inside this action, you can perform the
>> <xforms:setvalue> that populate one instance based on the content of
>> another instance.
>>
>> Sometimes XSLT can be another way to do the same thing. We have been
>> using XSLT in the past even more heavily than we do now (if you can
>> believe that!), but in general we are trying to limit the number of  
>> XSLT
>> transformations needed to generate a page, for performance reasons.  
>> It
>> also makes things simpler architecturally if you can look at your  
>> pages
>> as "just XForms calling REST services".
>>
>> Alex
>> --
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
>> Orbeon's Blog: http://www.orbeon.com/blog/
>> Personal Blog: http://avernet.blogspot.com/
>> Twitter - http://twitter.com/avernet
>>
>>
>
>
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
> Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
> Electronic Commerce Connection, Inc. |
> [hidden email]                    | Washington,DC SGML/XML Users  
> Grp
> URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
> Help Mac fight MLD (http://www.macsteam.org)
> Mark your calendar for October 28th (http://www.macsteam.org/BullROast.aspx 
> )
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws