Can normalize-space() be used with input controls?

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

Can normalize-space() be used with input controls?

Roger Costello

Hi Folks,

I have found that normalize-space() works fine with xforms:output, e.g.

<xforms:output value="normalize-space(...)"

But I get an error when I try to use it with xforms:input or xforms:textarea, e.g.

<xforms:textarea ref="normalize-space(..)"

Here is the error message I get:

org.orbeon.saxon.value.StringValue cannot be cast to org.orbeon.saxon.om.NodeInfo


My model contains data that I want to display for editing. I want to normalize the space in the data before displaying it to the user. Should I be using some other XPath function to do this?

/Roger

--
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: Can normalize-space() be used with input controls?

Hank Ratzesberger

Hi Roger,

The ref attribute requires single node binding, but
normalize-space() will return a string, not a node.

I'm sure there are better ways, but you could try to
setvalue of the node when the form is submitted --
passing the original value through normalize-space()
once before it is submitted.

Cheers,
Hank



On Dec 1, 2008, at 8:56 AM, Costello, Roger L. wrote:

>
> Hi Folks,
>
> I have found that normalize-space() works fine with xforms:output,  
> e.g.
>
> <xforms:output value="normalize-space(...)"
>
> But I get an error when I try to use it with xforms:input or  
> xforms:textarea, e.g.
>
> <xforms:textarea ref="normalize-space(..)"
>
> Here is the error message I get:
>
> org.orbeon.saxon.value.StringValue cannot be cast to  
> org.orbeon.saxon.om.NodeInfo
>
>
> My model contains data that I want to display for editing. I want  
> to normalize the space in the data before displaying it to the  
> user. Should I be using some other XPath function to do this?
>
> /Roger
> --
> 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: Can normalize-space() be used with input controls?

Erik Bruchez
Administrator
In reply to this post by Roger Costello
> My model contains data that I want to display for editing. I want to  
> normalize the space in the data before displaying it to the user.  
> Should I be using some other XPath function to do this?

You could use a calculation:

   <xforms:bind nodeset="my/node" calculate="normalize-space"/>

   <xforms:textarea ref="my/node">...

Wit this however, the calculation will occur everytime the value in  
the text area is committed to the instance. So maybe you want to do  
this just once upon initialization, e.g.:

   <xforms:setvalue ev:event="xforms-model-construct-done" ref="my/
node" value="normalize-space()"/>

-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