Example:
<div class='known' name='unknown'>
How can I return name attribute value ('unknown') based on known class attribure value, with XPath 1.0?
While looking for an answer I found that XPath 2.0 has instrument for this:
//div[@class='known']/@name/string()
But can't find XPath 1.0 analogy
Use:
This produces the string value of the
nameattribute of the first in document orderdivelement such that the string value of itsclassattribute is"unknown".If
//div[@class='known']selects more than onedivelement and you want the value of thenameattribute for the k-th selecteddiv, use:where
$khas to be substituted with the wanted integer, or otherwise the variable$kmust be in the evaluation context for the XPath expression.