Hi,
I want to do some styling based on some xml elements. For example, for a bid that is overdue i want to show them as red. The model looks as follows, <bids> <bid> <info>My Bid 1</info> <overdue>false</overdue> </bid> <bid> <info>My Bid 2</info> <overdue>true</overdue> </bid> </bids> I show this in the UI using a xforms-repeat element. However, if the "overdue" flag is true I would like to highlight that in red. Is there a way in OPS to achieve this. I tried tricks like, setting <xf:output class="if(instance('output')/bids/bid/overdue == 'true') then 'highlight-css-element' else 'normal-css-element"... However in the generated output that attribute doesnt seem to be evaluated (Since the expressions do not get evaluated for a class element). Can someone advice how to go about this? -- Regards, Kannan Ekanath -- 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 |
Hi Kannan,
This issue has been discussed quite often on this list. AFAIK there is only one way to do what you want - to use XForms construct like xforms:group or xforms:relevant as a wrapper for your HTML tags to hide/reveal them. Something like this could work in your case: <xforms:group ref="instance('output')/bids/bid[overdue = 'true']"> <xhtml:span class="overdue">content</xhtml:span> </xforms:group> <xforms:group ref="instance('output')/bids/bid[overdue = 'false']"> <xhtml:span class="regular">content</xhtml:span> </xforms:group> Erik also mentioned that future version of OF will support AVTs on XHTML elements so there is (a glimmer of) light at the end of the tunnel. A. On Dec 12, 2006, at 7:59 AM, [hidden email] wrote: > Hi, > I want to do some styling based on some xml elements. For example, > for a bid that is overdue i want to show them as red. The model > looks as follows, > <bids> > <bid> > <info>My Bid 1</info> > <overdue>false</overdue> > </bid> > <bid> > <info>My Bid 2</info> > <overdue>true</overdue> > </bid> > </bids> > > I show this in the UI using a xforms-repeat element. However, if > the "overdue" flag is true I would like to highlight that in red. > Is there a way in OPS to achieve this. I tried tricks like, setting > <xf:output class="if(instance('output')/bids/bid/overdue == 'true') > then 'highlight-css-element' else 'normal-css-element"... > > However in the generated output that attribute doesnt seem to be > evaluated (Since the expressions do not get evaluated for a class > element). Can someone advice how to go about this? > -- > Regards, > Kannan Ekanath > > -- > You receive this message as a subscriber of the ops- > [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 -- 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 |
Thanks Alexandar,
I was trying to remove the "content" duplication between both spans(which in my case is 100 odd lines). Anyways, in the below solution, I have one more question though. I am trying this inside xf:repeat element, which means that the xhtml looks like, <xf:repeat nodeset="instance('output')/bids/bid> <xf:group ref="[overdue='true']"> <span and content> </xf:group> <xf:group ref="[overdue='false']"> <span and content> </xf:group> </xf:repeat> Now it is cribbing that XPath syntax error at char 0 in {[partReturnRejected}: Unexpected token "[" in path expression. Now In the repeat element I am on the Bid node, so i cant say /bid[partReturnRejected='true'], I also tried getting value part but not quite getting it. Can you help me in this? Regards, Kannan On 12/12/06, Alexander Zatko <[hidden email]> wrote: Hi Kannan, -- Regards, Kannan Ekanath -- 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 |
Oops, I misread your suggestion, my ref should be,
<xf:group ref=".[overdue='true']"> <span and content> </xf:group> I was missing the "." ahead of the condition checking. I will check if i can move the "content" into another xml and do an include :) Thanks, Kannan On 12/12/06, [hidden email] <[hidden email]> wrote: Thanks Alexandar, -- Regards, Kannan Ekanath -- 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 |
Free forum by Nabble | Edit this page |