CDATA issue

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

CDATA issue

fceperko
This post was updated on .
Hello All,

I have one issue with displaying of "CDATA" content. I need set class in <div> dynamically. I didn't find way to do it so I made little work around using CDATA. When I put in XForm something like this:

<xf:trigger appearance="minimal" ref="tab1/selected">
   <xf:label>
      <![CDATA[<div class ="]]><xf:output ref="instance('variables')/menu/tab1/abcClass"/><![CDATA[">]]><xf:output ref="instance('variables')/menu/*/title[@id='abc']"/><![CDATA[</div>]]>
   </xf:label>
   <xf:action ev:event="DOMActivate">
      <xf:toggle case="abc" />
   </xf:action>
 </xf:trigger>

...everything is working well, and <div> is displayed correctly in GUI. But when I change instance "instance('variables')/menu/tab1/abcClass" using action and GUI is refreshed and this HTML div element is not displayed correctly, but it is displayed as plain text instead:
<div class ="somethingUnderAbcClass">Text from abc</div>

Can anybody help and explain why there is this different bahavior in displaying CDATA content please?

Thank you very much!

Best Regards,

Fero.
Reply | Threaded
Open this post in threaded view
|

Re: CDATA issue

Alessandro  Vernet
Administrator
Hi Fero,

Instead, try:

<xf:label>
    <xh:div class="{instance('variables')/menu/tab1/abcClass}">
        <xf:output ref="instance('variables')/menu/*/title[@id='abc']"/>
    </xh:div>
</xf:label>

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet