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
structure???
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
context.
******************************************
My doc is like this:
<rooms>
��������<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>
</rooms>
*****************************************
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">
<tr>
<td><script>${statoc.count}</script></td>
<td><script>${statoc.count*24}</script></td>
<td><script>${maxoc}</script></td>
</tr>
</jx:forEach>
</jx:macro>
<table>
<tbody>
<tablerows maxoc="${description.getAttribute('maxoc')}"/>
</tbody>
</table>
</forEach>
*************************************
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 ??
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]