GIMME wrote:
For starters ....
If :
//input[@name='start_date']
is the xpath syntax to see if an element with an attribute
named start_date exists ...
No, that expression looks for <input> elements at all levels that have
an attribute named 'name' that has the value 'start_date'.
You will be able to look for for elements with an attribute named
'start_date' with the XPath expression
//input[@start_date]
Then what is the xpath syntax to return elements having
an attribute named '*date*' .
That is there a way to turn start_date into a regular expression?
XPath 1.0 doesn't support any regular expressions, there are however
some string functions like contains so could try
//input[contains(local-name(@*), 'date')]
with the example XML being
<?xml version="1.0" encoding="UTF-8"?>
<root>
<input date="2004-01-01" />
<input start_date="2004-01-01" />
<input date_final="2004-10-10" />
<input att="Kibology" />
<input />
</root>
the above XPath selects
<input date="2004-01-01" />
<input start_date="2004-01-01" />
<input date_final="2004-10-10" />
--
Martin Honnen
http://JavaScript.FAQTs.com/