Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What XPath Expression Will Retrieve Only Terminal Child Elements?

0
Posted

What XPath Expression Will Retrieve Only Terminal Child Elements?

0

Question Can you tell me what XPath expression I should use to retrieve only terminal child elements (that is, elements which don’t have any child elements) from a specified element. For example, I want to use an XPath expression to return only the TABLE child elements highlighted in red below:

111 1 Customers c Categories 01/10/2000
Answer 1 A possible solution is the following: Answer 2 The expression you want is: /TABLE/*[count(child::*) = 0] or /TABLE/*[not (child::*)] You can omit the child axis, so above expression is the same as: /TABLE/*[count(*) = 0] or /TABLE/*[not (*)] Child Att

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123