cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oceatoon <>
Subject Re: Help: XPath to Jexl
Date Tue, 21 Sep 2004 10:22:51 GMT
Sylvain Wallez wrote:

> oceatoon wrote:
>>Hi everyone
>>I am having trouble retreiving an attribute in jexl.
>>In jxpath, I can retreive it like this #{./description/@maxoc}
>>but ${description.maxoc} doesn't work, can someone guide me please??
> Jexl is a JavaBeans-oriented expression language. So you can't access
> attributes in an XML document using Jexl, except by using the DOM API
> (e.g. "${description.getAttribute("maxoc")}"). JXPath, on the contrary,
> traverses both DOM and JavaBeans hierarchies.
> So in that particular case, using JXPath is the IMO the appropriate
> choice.
> Sylvain
Merci Sylvain, but I got a problem to your solution probably related to my

I absolutely agree with you and I started using JXPath, but unfortunetly I
haven't managed to get the JXTemplate jx:forEach 'end' 'begin' tags to work
with JXPath, nore the jx:macro??? which got me to jexl

my problem here is that , the jexl is in a forEach which is itself is
looping on a forEach, so my jexl call is relative to the first forEach
My doc is like this:
        <room><desc maxoc="12">text0</desc></room>
        <room><desc maxoc="5"/>text1</desc></room>
        <room><desc maxoc="6"/>text2</desc></room>
        <room><desc maxoc="9"/>text3</desc></room>
This is in my html_jx page:
 <jx:forEach select="#{rooms/room}"  varStatus="status">
 <jx:macro name="tablerows">
      <jx:parameter name="maxoc"/>
      <jx:forEach begin="0" end="${maxoc}" step="1" varStatus="statoc">
       <tablerows maxoc="${description.getAttribute('maxoc')}"/>  


So as you can see the jexl element I need is relative to each room,  can
someone help me retreive the /rooms/room/description/@maxoc for each
room ?? 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message