Xpath to check for multiple empty children
With the following xml, I am trying to return true
or false
depending on whether all elements are empty <CrucialNumber>
:
<Invoice>
<Details>
<LIN1>
<Quantity>1</Quantity>
<Product>Test XML</Product>
<CrucialNumber/>
</LIN1>
<LIN1>
<Quantity>1</Quantity>
<Product>Test XML</Product>
<CrucialNumber/>
</LIN1>
<LIN1>
<Quantity>1</Quantity>
<Product>Test XML</Product>
<CrucialNumber>123456</CrucialNumber>
</LIN1>
</Details>
</Invoice>
The item data type CrucialNumber
is string
.
So far, these are the xpath expressions I've tried:
string-length(//CrucialNumber/*) > 0;
not(//CrucialNumber/*[text()]);
./Details/LIN1[*]/CrucialNumber[1] = "";
+3
source to share