Thanks, Kris. I don't want to get the child value - that's easy enough. I want to get their ID values. It doesn't appear that your code is doing that, but then again I'm the guy who doesn't know how. Maybe I don't recognize correct code when I see it. ;)
Am I misunderstanding here? I'll apologize in advance if that's so. - MOD --- Kris Schneider <[EMAIL PROTECTED]> wrote: > This seemed to work: > > <%@ page contentType="text/plain" %> > <%@ taglib prefix="x" > uri="http://java.sun.com/jstl/xml" %> > > <x:parse var="doc"> > <parent><child/><child/><child/><child/></parent> > </x:parse> > > <x:set var="child1" select="$doc//parent/child[1]"/> > <x:set var="child4" select="$doc//parent/child[4]"/> > > child1: <x:out > select="count($child1/preceding-sibling::child) + > 1"/> > child4: <x:out > select="count($child4/preceding-sibling::child) + > 1"/> > > Of course, if you had elements like <child id="1"/>, > it would be even easier to > get at: > > child1: <x:out select="$child1/@id"/> > > Quoting Michael Duffy <[EMAIL PROTECTED]>: > > > > > If I have an XML stream like this: > > > > <parent><child/><child/><child/><child/></parent> > > > > I can refer to each child individually using > XPath: > > > > //parent/child[1] gives me the first child, > > //parent/child[2] gives me the second child, > > etc. > > > > When I use JSTL <xml> tags, is it possible to get > that > > ID number out? I've got a List of child tags that > I > > want to use in an HTML checkbox input, and I'd > like to > > be able to identify selected items by their ID. > > Thanks - MOD > > -- > Kris Schneider <mailto:[EMAIL PROTECTED]> > D.O.Tech <http://www.dotech.com/> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
