tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul P Akolkar <akol...@us.ibm.com>
Subject RE: JSTL Recursion possible??
Date Tue, 03 May 2005 10:56:27 GMT
Given that the c:import is yielding the XML that you sketched out in your 
previous email, you can parse it (using <x:parse>) and iterate over the 
<b> nodes using <x:forEach>, and using the // XPath operator, like so:

<x:forEach select="$doc//b" var="b_node">

  <%-- do something with every b node, lets say send ids to JspWriter --%>
  <x:out select="$b_node/@id" />

</x:forEach>

-Rahul


On 5/3/05, Gros, Martin <gros_martin@emc.com> wrote:
> 
> I want to build a tree, do something with every node b, and if node b 
has b
> nodes as children, do the same to these b nodes, and if these b nodes 
has b
> nodes as children, do the same to these, and if.......
> 
> I tried to capsule the jstl fragment to handle nodes into an own jsp 
file
> and call this jsp with a c:import. The problem i had was to remember the
> node and to give the current node into a variable. My "function" was 
called
> infinite...
> 
> Martin
> 
> 
> -----Original Message-----
> From: Rahul P Akolkar [mailto:akolkar@us.ibm.com]
> Sent: Dienstag, 3. Mai 2005 03:51
> To: Tag Libraries Users List
> Subject: Re: JSTL Recursion possible??
> 
> I, for one, did not understand the question (or what the nesting you 
show
> has to do with "JSTL recursion"). Can you please try again?
> 
> Thanks,
> -Rahul
> 
> On 5/2/05, Gros, Martin <gros_martin@emc.com> wrote:
> > JSTL and recursion, is this possible?
> >
> > e.g. walk an xml tree with same element names on different levels?
> >
> > <a>
> >    <b/>
> >    <b/>
> >    <c>
> >        <b/>
> >    </c>
> >    <c>
> >        <b>
> >            <b/>
> >        </b>
> >    </c>
> >    <b>
> > </a>
> >
> > i want an output like
> >
> > b
> > b
> > --b
> > --b
> > ----b
> > b
> >
> > is this possible? if yes, could you provide a short example?
> >
> > thanks
> >
> > Martin
> >
> >
> 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message