Hi David,

Should be as simple as //X[@A='foo']/@B.

Predicates (the expressions in square brackets) filter the nodes they
are applied to, so after @A='foo' has been evaluated you are left with X
elements whose B attributes you can select.

Regards,

Steen Lehmann

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:jaxen-interest-admin@;lists.sourceforge.net] On Behalf 
> Of David Corbin
> Sent: 27. oktober 2002 19:40
> To: [EMAIL PROTECTED]
> Subject: [Jaxen] XPath help...
> 
> 
> 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.
> 
> Thanks.
> David Corbin
> 
> 
> 
> -------------------------------------------------------
> 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