is there a possibility to determine in which "level" this b node appears?



-----Original Message-----
From: Rahul P Akolkar
To: Tag Libraries Users List
Sent: 03.05.2005 03:56
Subject: RE: JSTL Recursion possible??

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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> 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 <[EMAIL PROTECTED]> 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
> >
> >
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to