XPath to filter SalesInvoiceLines_Tax on TaxAmount

I’m trying to duplicate some work I did on a SalesOrderConfirmation. There in the SubTotal table I successfully used a grouping element like so:
SalesConfirmTaxLines[@TaxAmount != 0].

Now on my SalesInvoice I need to do the same kind of logic, but when I enter this:
SalesInvoiceLines_Tax/[@TaxAmount != 0]
the XPathh Result is: Expresssion must evaluate to a node-set.
I’ve confirmed that there are multiple lines in the ddsp under SalesInvoiceLines_Tax

I’m still learning XPath, any tips and pointers would be greatly appreciated.

Best Regards,

  • Jim

Found the problem… ‘/’ was not necessary. So
this: SalesInvoiceLines_Tax/[@TaxAmount != 0] gives the error.

But this:
SalesInvoiceLines_Tax[@TaxAmount !=0]
Does not…
I think this solves it.


You are correct, when you use square bracket notation for filtering on the node level, you don’t need the forward slash → SalesInvoiceLines_Tax[@TaxAmount != 0]

When you need to specify a path to the specific field, you then use the forward slash → SalesInvoiceLines_Tax/@TaxAmount