Not a problem, glad it'll work. Quoting Michael Duffy <[EMAIL PROTECTED]>:
> > Of course you're correct, Kris. I'm going too fast > and not thinking enough. Thanks again for the great > advice, and I'm sorry to bother you. Sincerely, MOD > > > --- Kris Schneider <[EMAIL PROTECTED]> wrote: > > I guess it all depends on what you mean by "ID > > values". I interpreted it as > > equivalent to the position with respect to the > > parent: > > > > <parent> > > <child/> <!-- id=1 --> > > <child/> <!-- id=2 --> > > <child/> <!-- id=3 --> > > <child/> <!-- id=4 --> > > </parent> > > > > So, counting the number of preceding "child" > > siblings seemed appropriate. Did > > you have something else in mind? > > > > Quoting Michael Duffy <[EMAIL PROTECTED]>: > > > > > 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/> > > > > -- > > Kris Schneider <mailto:[EMAIL PROTECTED]> > > D.O.Tech <http://www.dotech.com/> -- 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]
