I'm using XSLT to try to grab content from an html page. I want to select all the <p> tags but exclude all the <li> tags. There is one page where the li tags are not within any of the p tags. For this page, how can I select all p elements but leave out all li elements? I'm trying to use the Xpath exclusion notation, e.g. [not()]

Recommended Answers

All 2 Replies

Why doesn't //p work?

You're problem isn't very well described. If you want a clear answer, please give is a stripped down sample document that we can see and use to see your problem. Along with what your desired result set looks like. Do something like this user does in this thread.

http://www.daniweb.com/forums/thread326036.html

OK, sorry about the bad description. I just needed to play with Xpath a bit more before I realized how it was working. The solution I used happened to be:

//div[@id='text']/p

Which simply excludes everything but the p elements in the defined path. No need for an exclusion expression.

Thank you much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.