Xpath / Find all attributes which start with specific pattern -


i want find elements there attributes start x.

for example,

<a xt="1"> text1 </a> <a xu="2"> text2 </a> <a text1="3"> text3 </a> 

the xpath find first 2 elements, because contains attributes name xt , xu, respectively. text1 attribute doesn't start x, , not it.

i try start-with() function, understood find values, , not attributes.

i use:

//*[@*[starts-with(local-name(),'x')]] 

similar other answer, uses local-name() instead. check attribute name , not namespace prefix.

for example, if use local-name() following matched because prefix starts x...

<a xns:text1="3" xmlns:xns="xns"> text3 </a> 

if use local-name(), not match because local name of xns:text1 text1.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -