convert from xhtml to text

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

convert from xhtml to text

simone123456
I have one file xhtml that I want display on text area but before i must translate the xhtml tag to text, for example <xhtml:boby> must become  &lt;/xhtml:body&gt; for see it on text area.
I have two problem:
The first is that I have try to do this submission <xforms:submission id="conversion" method="post" action="run" ref="instance('instance-xhtm2')" replace="instance" instance="instance-xhtm1"/> that should call one xpl that translate and put the result on
instance-xhtm1 but don't work good
The second is that with other example I have see that this xpl don't convert < or > to &lt or &gt
don't know why becouse I have put some debug tag and the result was ok from this tag

however I have post one example about my problem for expain me  better


problem1.zip 
Reply | Threaded
Open this post in threaded view
|

Re: convert from xhtml to text

Erik Bruchez
Administrator
Try the saxon:serialize() function:

   saxon:serialize(instance('instance-xhtm2'), 'html')

-Erik

On Sep 1, 2008, at 6:46 AM, simone123456 wrote:

>
> I have one file xhtml that I want display on text area but before i  
> must
> translate the xhtml tag to text, for example <xhtml:boby> must become
> &amp;lt;/xhtml:body&amp;gt; for see it on text area.
> I have two problem:
> The first is that I have try to do this submission <xforms:submission
> id="conversion" method="post" action="run" ref="instance('instance-
> xhtm2')"
> replace="instance" instance="instance-xhtm1"/> that should call one  
> xpl that
> translate and put the result on
> instance-xhtm1 but don't work good
> The second is that with other example I have see that this xpl don't  
> convert
> < or > to &amp;lt or &amp;gt
> don't know why becouse I have put some debug tag and the result was  
> ok from
> this tag
>
> however I have post one example about my problem for expain me  better
>
>
> http://www.nabble.com/file/p19254993/problem1.zip problem1.zip
> --
> View this message in context: http://www.nabble.com/convert-from-xhtml-to-text-tp19254993p19254993.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
--
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: convert from xhtml to text

simone123456

Erik Bruchez wrote
Try the saxon:serialize() function:

   saxon:serialize(instance('instance-xhtm2'), 'html')

-Erik
thanks but    <xforms:output value="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"   /> it's
ok but if I have (my work) <xforms:textarea ref="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"
   appearance="xxforms:autosize" incremental="false" >
                <xforms:label>  </xforms:label>
   </xforms:textarea>
give me this 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

Simone
--------
Reply | Threaded
Open this post in threaded view
|

Re: Re: convert from xhtml to text

fl.schmitt(ops-users)
simone123456,

> thanks but    <xforms:output
> value="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"   /> it's
> ok but if I have (my work) <xforms:textarea
> ref="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"
>    appearance="xxforms:autosize" incremental="false" >
> <xforms:label>  </xforms:label>
>    </xforms:textarea>
> give me this 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

As the error says - if you use ref="" to set the control content, you
have to reference a node. The saxon:serialize function returns a String,
so you can't ref that result. Does value="saxon:serialize(...)" instead
of ref="" work?

HTH
florian



--
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: convert from xhtml to text

Erik Bruchez
Administrator
>> thanks but    <xforms:output

>> value="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"   />  
>> it's
>> ok but if I have (my work) <xforms:textarea
>> ref="saxon:serialize(instance('instance-xhtm2'), 'xhtml')"
>>   appearance="xxforms:autosize" incremental="false" >
>> <xforms:label>  </xforms:label>
>>   </xforms:textarea>
>> give me this 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
>
> As the error says - if you use ref="" to set the control content, you
> have to reference a node. The saxon:serialize function returns a  
> String,
> so you can't ref that result. Does value="saxon:serialize(...)"  
> instead
> of ref="" work?
No, you have to store the value into the node using xforms:setvalue or  
xforms:bind/@calculate, and ref that node from the control.

-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: Re: convert from xhtml to text

simone123456

Erik Bruchez wrote
No, you have to store the value into the node using xforms:setvalue or  
xforms:bind/@calculate, and ref that node from the control.

-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 ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
right now work, thanks