Hi Mike,
What I meant is that the variable status.index is not parsed as a variable
but as a string.
I get an empty object back with this command:
${doc.content.xpath['/root/list/article[status.index]/@id']}
because he tries to find the path '/root/list/article[status.index]/@id'
instead of '/root/list/article[1]/@id'
Thanks for your reply,
Wilson
2008/5/27, Mike Meijnhard <[EMAIL PROTECTED]>:
>
> Hi Wilson,
>
> status.index should be an int, but the index variable is probably a
> String because of automatic type conversion. Why don't you use this:
>
> <c:set var="xpath"
> value="/content/${doc.content.xpath['/root/list/article[status.index]/@i
> d']}.xml"/>
>
> Regards,
>
> Mike
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > Wilson de Paula Pedro Junior
> > Sent: dinsdag 27 mei 2008 11:56
> > To: Hippo CMS development public mailinglist
> > Subject: [HippoCMS-dev] Dynamic Index with xpath
> >
> > Hello,
> >
> > I have a foreach tag where I want to use the index of the
> > loop in a xpath:
> >
> > <c:forEach begin="1" end="3" varStatus="status">
> > <c:set var="index" value="{status.index}" />
> > <c:set var="xpath" >
> > /content/${doc.content.xpath['/root/list/article[index]/@id']}
> .xml</c:set>
> > </c:forEach>
> > The xpath takes the index variable as a string.
> > Does anybody knows how I can use this index in the xpath?
> >
> > Thank you!
> >
> > Wilson de Paula Pedro Junior
> > ********************************************
> > Hippocms-dev: Hippo CMS development public mailinglist
> >
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
********************************************
Hippocms-dev: Hippo CMS development public mailinglist