0
<div class="content" style="opacity: 1;">
      <div class="A" >
      <ul class ="any" >
      <div class ="demo" >
      <div class="pipe" >
      <ul class= "markedl-list">

I want to select class content except sub class "marked-list" Any help?

Arunkumar
  • 55
  • 5

1 Answers1

2

Assuming the elements you're trying to select are direct children of div with the class content and you don't need to select the parent "content" div, this xpath 1.0 should work...

//div[contains(concat(' ',normalize-space(@class),' '),' content ')]/*[not(contains(concat(' ',normalize-space(@class),' '),' markedl-list '))]

Note the possible misspelling of "markedl-list".

Also, the use of contains(concat(' ',normalize-space(@class),' '),' someclass ') might seem like overkill, but will account for the possibility of classes other than the target class being in the class attribute. If you can use XPath 2.0, this test is much cleaner (How can I match on an attribute that contains a certain string?).

Example: http://www.xpathtester.com/xpath/d449841c402b3e15ef69e3004a39ee6c

Community
  • 1
  • 1
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95