Select1 + Value + Concat

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

Select1 + Value + Concat

NJ No1

Hi all,

 

Lets say I have a:

Request instance:

 

<a>

            <target>

</b>

 

 

Test instance:

 

<test>

               <name>blah</name>

               <y>

                        <z>blah2</z>

                        <z>blah3</z>

              </y>

</test>

 

And I want something like this:

 

<xforms:select1 ref="instance('request_instance')/target" appearance="full">

            <xforms:item>

                        <xforms:label ref="instance('request_instance')/name"/>

                        <xforms:value ref="??"/> 

            </xforms:item>

</xforms:select1>

 

I want the value of the radio button to be all the values of z separated by a ‘,’. For example “blah2, blah3”. I wasn’t too sure how this could be done as there isn’t that much XPath functions, can anyone help?

 

Thanks,

NJ

NOTICE

This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

 



--
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: Select1 + Value + Concat

Steve Lenhart
Naman,
 
I think the XPath function you would want to use woudl be string-join() ...... something like this ...
 
string-join(instance('test_instance')//z, ',')
 
 
Steve
 
 
 
 
STEVE LENHART
WEB DEVELOPER
TELEFLEX CORPORATE IT
155 SOUTH LIMERICK ROAD
LIMERICK, PA 19468
TEL> 610-948-1744
MOB> 484-919-5578
 


   From: Naman Joshi [mailto:[hidden email]]
Sent: Monday, June 18, 2007 2:00 AM
To: [hidden email]
Subject: [ops-users] Select1 + Value + Concat

Hi all,

 

Lets say I have a:

Request instance:

 

<a>

            <target>

</b>

 

 

Test instance:

 

<test>

               <name>blah</name>

               <y>

                        <z>blah2</z>

                        <z>blah3</z>

              </y>

</test>

 

And I want something like this:

 

<xforms:select1 ref="instance('request_instance')/target" appearance="full">

            <xforms:item>

                        <xforms:label ref="instance('request_instance')/name"/>

                        <xforms:value ref="??"/> 

            </xforms:item>

</xforms:select1>

 

I want the value of the radio button to be all the values of z separated by a ‘,’. For example “blah2, blah3”. I wasn’t too sure how this could be done as there isn’t that much XPath functions, can anyone help?

 

Thanks,

NJ

NOTICE

This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

 



--
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: Select1 + Value + Concat

NJ No1

Hi Steve,

 

Thanks for your reply. I tried what you suggested and I got:

“XForms error: A reference to a node (such as text, element, or attribute) is required in a binding. Attempted to bind to the invalid item type: class java.lang.String”

 

But I was thinking, wouldn’t it be a little more complicated then just doing a // to concatenate ALL the z elements with z as a separator?

 

Naman


From: Steve Lenhart [mailto:[hidden email]]
Sent: Monday, 18 June 2007 9:37 PM
To: [hidden email]
Subject: RE: [ops-users] Select1 + Value + Concat

 

Naman,

 

I think the XPath function you would want to use woudl be string-join() ...... something like this ...

 

string-join(instance('test_instance')//z, ',')

 

 

Steve

 

 

 

 

STEVE LENHART

WEB DEVELOPER

TELEFLEX CORPORATE IT

155 SOUTH LIMERICK ROAD

LIMERICK, PA 19468

TEL> 610-948-1744

MOB> 484-919-5578

EMAIL> [hidden email]

 

 


   From: Naman Joshi [mailto:[hidden email]]
Sent: Monday, June 18, 2007 2:00 AM
To: [hidden email]
Subject: [ops-users] Select1 + Value + Concat

Hi all,

 

Lets say I have a:

Request instance:

 

<a>

            <target>

</b>

 

 

Test instance:

 

<test>

               <name>blah</name>

               <y>

                        <z>blah2</z>

                        <z>blah3</z>

              </y>

</test>

 

And I want something like this:

 

<xforms:select1 ref="instance('request_instance')/target" appearance="full">

            <xforms:item>

                        <xforms:label ref="instance('request_instance')/name"/>

                        <xforms:value ref="??"/> 

            </xforms:item>

</xforms:select1>

 

I want the value of the radio button to be all the values of z separated by a ‘,’. For example “blah2, blah3”. I wasn’t too sure how this could be done as there isn’t that much XPath functions, can anyone help?

 

Thanks,

NJ

NOTICE

This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

 



--
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: Select1 + Value + Concat

Steve Lenhart
Naman,
 
You get that error because the ref attribute for the item will need to be bound to a node, not an xpath expression .... one way to do this would be to make another instance with a node in it and store the result of the string-join in there. I believe the string-join should work for you unless there is something I'm missing here .... I don't think concat() will work for you since you have a sequence that you want separated by commas ..
 
you could try something like this in your model ...
 
 
<xforms:instance id="temp">
<temp xmlns="">
    <joined-z/>
</temp>
</xforms:instance>
 
<xforms:bind nodeset="instance('temp')/joined-z" calculate="string-join(instance('test_instance')//z, ',')"/>
 
and then in your view ...
 

<xforms:select1 ref="instance('request_instance')/target" appearance="full">

            <xforms:item>

                        <xforms:label ref="instance('request_instance')/name"/>

                        <xforms:value ref="instance('temp')/joined-z"/> 

            </xforms:item>

</xforms:select1>

 

 

 

HTH.

Steve

 
 
 
 
 
 
STEVE LENHART
WEB DEVELOPER
TELEFLEX CORPORATE IT
155 SOUTH LIMERICK ROAD
LIMERICK, PA 19468
TEL> 610-948-1744
MOB> 484-919-5578
 


   From: Naman Joshi [mailto:[hidden email]]
Sent: Monday, June 18, 2007 7:36 PM
To: [hidden email]
Subject: RE: [ops-users] Select1 + Value + Concat

Hi Steve,

 

Thanks for your reply. I tried what you suggested and I got:

“XForms error: A reference to a node (such as text, element, or attribute) is required in a binding. Attempted to bind to the invalid item type: class java.lang.String”

 

But I was thinking, wouldn’t it be a little more complicated then just doing a // to concatenate ALL the z elements with z as a separator?

 

Naman


  

From: Steve Lenhart [mailto:[hidden email]]
Sent: Monday, 18 June 2007 9:37 PM
To: [hidden email]
Subject: RE: [ops-users] Select1 + Value + Concat

 

Naman,

 

I think the XPath function you would want to use woudl be string-join() ...... something like this ...

 

string-join(instance('test_instance')//z, ',')

 

 

Steve

 

 

 

 

STEVE LENHART

WEB DEVELOPER

TELEFLEX CORPORATE IT

155 SOUTH LIMERICK ROAD

LIMERICK, PA 19468

TEL> 610-948-1744

MOB> 484-919-5578

EMAIL> [hidden email]

 

 


  

   From: Naman Joshi [mailto:[hidden email]]
Sent: Monday, June 18, 2007 2:00 AM
To: [hidden email]
Subject: [ops-users] Select1 + Value + Concat

Hi all,

 

Lets say I have a:

Request instance:

 

<a>

            <target>

</b>

 

 

Test instance:

 

<test>

               <name>blah</name>

               <y>

                        <z>blah2</z>

                        <z>blah3</z>

              </y>

</test>

 

And I want something like this:

 

<xforms:select1 ref="instance('request_instance')/target" appearance="full">

            <xforms:item>

                        <xforms:label ref="instance('request_instance')/name"/>

                        <xforms:value ref="??"/> 

            </xforms:item>

</xforms:select1>

 

I want the value of the radio button to be all the values of z separated by a ‘,’. For example “blah2, blah3”. I wasn’t too sure how this could be done as there isn’t that much XPath functions, can anyone help?

 

Thanks,

NJ

NOTICE

This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

 



--
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: Select1 + Value + Concat

Alessandro Vernet
Administrator
In reply to this post by NJ No1
Naman,

On 6/18/07, Naman Joshi <[hidden email]> wrote:
> Thanks for your reply. I tried what you suggested and I got:
>
> "XForms error: A reference to a node (such as text, element, or attribute)
> is required in a binding. Attempted to bind to the invalid item type: class
> java.lang.String"

Like Steve said, if you use <xforms:value ref="..."/>, the XPath
expression needs to return a node. So you can't use string-join().
However, you can do <xforms:value value="..."/>. With the value
attribute, returning a string is OK.

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