With the following xml, I’m trying to return true or false depending on whether all <CrucialNumber> elements are empty or not:
<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 data-type of the CrucialNumber element is string.
So far, these are the xpath expressions I have tried:
string-length(//CrucialNumber/*) > 0;
not(//CrucialNumber/*[text()]);
./Details/LIN1[*]/CrucialNumber[1] = "";
should do it, it will be true if and only if either (a) there are no
CrucialNumberdescendant elements at all, or (b) all the descendantCrucialNumberelements are empty.