So, we don't think this would work, really?

        /A/B/string(.) 

Select all A nodes.

Select all B children of those A nodes.

For each B node, select the string value of it.

Granted, I haven't tested this...

        -bob



On Mon, 28 Oct 2002, James Strachan wrote:

> I guess we could write an extension function to do this. Something like
> 
> string-list(/A/@B)
> 
> which would return a list of the string() value of each node in the node set
> parameter.
> 
> Though it would be pretty easy to do this in Java code as well. For example,
> David, here's how you could do it with dom4j...
> 
> List attributes = document.selectNodes("/A/@B");
> List textList = new ArrayList();
> for (Iterator iter = attributes.iterator(); iter.hasNext(); ) {
>     Attribute attr = (Attribute) iter.next();
>     textList.add( attr.getText() );
> }
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> ----- Original Message -----
> From: "Steen Lehmann" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, October 28, 2002 8:31 AM
> Subject: Re: [Jaxen] XPath help...
> 
> 
> Hmmm, just checked the spec and don't think this would work. string() would
> have to be wrapped around the expression: string(/A/@B) and this would just
> convert the first node in /A/@B to a string. I don't see any functions in
> the spec which take a node list as an argument and deliver anything else
> than a single primitive type (except the id function which returns a
> node-set), and you can't walk down an axis on each attribute to get its
> value (you can't do something like /A/@B/text() since attributes do not have
> text children).
> 
> -- Steen
> 
> >>> bob mcwhirter <[EMAIL PROTECTED]> 10/28/02 02:45am >>>
> > Next question.  Using dom4j, when I do a selectNodes, I get by  a list
> > of  org.dom4j.tree.DefaultAttribute objects.  I'd like to have a list of
> > String objects.  Is this possible?
> 
> I think append a string() to the tail...
> 
> /A/B/string()
> 
> But, I could be wrong.  Check the xpath spec for the functions
> available to you.
> 
> -bob
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: ApacheCon, November 18-21 in
> Las Vegas (supported by COMDEX), the only Apache event to be
> fully supported by the ASF. http://www.apachecon.com
> _______________________________________________
> Jaxen-interest mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jaxen-interest
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Jaxen-interest mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jaxen-interest
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 

--
Bob McWhirter        [EMAIL PROTECTED]
The Werken Company   http://werken.com/



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to