XPath syntax to find all nodes that don't have some attribute at all? [modified]
-
Excuse me for this quick noob question. Let's say I have XML:
<a name="a1">text</a> <a>text 2</a> <a name="a3">text 3</a>
What's the XPath syntax to locate that secon "a" element that doen't have the "name" attribute? -- modified at 12:42 Tuesday 1st August, 2006 -
Excuse me for this quick noob question. Let's say I have XML:
<a name="a1">text</a> <a>text 2</a> <a name="a3">text 3</a>
What's the XPath syntax to locate that secon "a" element that doen't have the "name" attribute? -- modified at 12:42 Tuesday 1st August, 2006Try this:
a[not(boolean(@name))]
That will give you everything that doesn't have a name attribute.
Logifusion[^] If not entertaining, write your Congressman.
-
Try this:
a[not(boolean(@name))]
That will give you everything that doesn't have a name attribute.
Logifusion[^] If not entertaining, write your Congressman.
Oh, that's great! Thanks a lot! Works!:-D