xpath questions...

B

bruce

Hi...

playing around with xpath and the html dom...

i've got a sample:

html

body

form action='foo' name='cat'....

/form

/body

/html



i can create a test xpath:
//form/[action
and get the form stuff...

i'm curious, is there a way to select an attribute, only if another
attribute in the element is set to a given value??

something like
//form/[@action='foo'][@name]
which would try to return name, if the action==foo....

didn't see this in any of the docs that i reviewed.. nor could i get it to
work when i was playing around with xpather on firefox..

thoughts/comments/pointers...

thanks
 
S

Stefan Behnel

Hi,

this is totally not Python related, so this is the wrong list.
form action='foo' name='cat'....

i'm curious, is there a way to select an attribute, only if another
attribute in the element is set to a given value??

something like
//form/[@action='foo'][@name]
which would try to return name, if the action==foo....

//form[@action='foo']/@name
didn't see this in any of the docs that i reviewed.. nor could i get it to
work when i was playing around with xpather on firefox..

thoughts/comments/pointers...

Read a good XPath tutorial.

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top