Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6659269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:00:49+00:00 2026-05-26T02:00:49+00:00

I have got an HTML snippet similar to: <div id="root"> <div id="A" attrib_2="bar"></div> <div

  • 0

I have got an HTML snippet similar to:

<div id="root">
    <div id="A" attrib_2="bar"></div>
    <div id="B" attrib_2="baz">
        <div id="H" attrib_1="gnu">
            <p>
                <div id="F" attrib_2="baz"></div>
            </p>
        </div>
    </div>
    <div id="C" attrib_2="owl"></div>
    <div id="D" attrib_2="uhu"></div>
    <div id="E" attrib_2="boom"></div>
</div>

Now, I would like to select all snippets having an attrib_2 (*[attrb_2]) excluding those being descendants of a node having an attrib_1 set. There can be more nesting levels with arbitrary tags (like <p> in this example). With Enlive (http://enlive.cgrand.net/), I have already tried something like:

(select snippet [(but (attr? :attrib_1)) (attr? :attrib_2)])

But this doesn’t work because the negation (but (attr? :attrib_1)) matches also the <p> tag. Is there a way to express this with the given selector predicates (http://enlive.cgrand.net/syntax.html), or do I have to write my own?

Thanks in advance

-Jochen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:00:49+00:00Added an answer on May 26, 2026 at 2:00 am

    You have to write your own selector:

    (def parents 
      (zip-pred (fn [loc pred]
                  (some pred (take-while identity (iterate zip/up loc))))))
    

    (untested)

    and then

    (select snippet [[(attr? :attrib_2) (but (parents (attr? :attrib_1))]])
    

    should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got this html: <div id=myDiv> <p class=readMore></p> <p class=readMore></p> <p class=readMore></p> </div>
I have got below ASP html <div id=divCheckAll> <div class=selectall> <input type=checkbox id=chkOperationalUpdate name=chkOperationalUpdate
We have got an extjs 3.1.1 form with file upload field ( http://www.extjs.com/deploy/dev/examples/form/file-upload.html from
I have got a simple HTMl form with one field as follows: <input type=text
I have got html as below <a href= data-href=/somefile.php?id=10&refcode=/test.php>Hello</a> and I need to replace
For example I have this snippet of html code: ..... <span class=no> 1</span> require
I am trying to use javascript/jquery. I have got below HTML where I want
I have got as far as getting the HTML response into a variable and
I have got a Base64 image in an HTML embedded, how can I decode
I have got a HTML table which contain a check box in <TH> and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.