You should be able to call the StringFunction directly on each item in the
resultant list. Something like:

XPath xpath = new Dom4jXPath( "//X[@A='foo']/@B" );
Navigator nav = org.jaxen.dom4j.DocumentNavigator.getInstance();
List ls = xpath.selectNodes( .. );
Iterator it = ls.iterator();

while( it.hasNext() ) {
        String s = (String)org.jaxen.function.StringFunction.evaluate(
                                it.next(), nav );
        ...
}

- Ryan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:jaxen-interest-admin@;lists.sourceforge.net]On Behalf Of David
Corbin
Sent: Sunday, October 27, 2002 5:58 PM
To: bob mcwhirter
Cc: [EMAIL PROTECTED]
Subject: Re: [Jaxen] XPath help...


bob mcwhirter wrote:

>On Sun, 27 Oct 2002, David Corbin wrote:
>
>
>
>>I've got an element X with two attributes, A & B.  I want to identify
>>the B attribute but only for elements that have an A value == 'foo'.
>>
>><X A='bar' B='red'/>
>><X A='foo' B='green'/>
>><X A='bar' B='blue'/>
>><X A='foo' B='yellow'/>
>>
>>So, selectNodes shhould return "green" & "yellow".
>>
>>I know that //X[@A='foo'] will get me the right set of X nodes,
>>and I know that //X/@B will get me the attribute B values,
>>but I'm not sure how they should be combined.
>>
>>
>
>
>       //X[@A='foo']/@B
>
>-bob
>
>
>
Thanks.  For some reason, I'd put a / in front of the predicate.

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?

David

>
>
>
>SPAM: -------------------- Start SpamAssassin
results ----------------------
>SPAM: This mail is probably spam.  The original message has been altered
>SPAM: so you can recognise or block similar unwanted mail in future.
>SPAM: See http://spamassassin.org/tag/ for more details.
>SPAM:
>SPAM: Content analysis details:   (-4.4 hits, 4 required)
>SPAM: Hit! (-4.4 points) 'In-Reply-To' line found
>SPAM:
>SPAM: -------------------- End of SpamAssassin
results ---------------------
>
>
>




-------------------------------------------------------
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: 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

Reply via email to