Inspectopedia Help

XPath predicate with index 0

Reports usages of 0 in a predicate index or in a comparison with the function position(). Such usage is almost always a bug because in XPath, the index starts at 1, not at 0.

Example:

//someelement[position() = 0]

or

//something[0]

Inspection Details

Available in:

AppCode 2023.3, CLion 2023.3, DataGrip 2023.3, IntelliJ IDEA 2023.3, JetBrains Rider 2023.1, PhpStorm 2023.3, Qodana for .NET 2023.1, Qodana for JVM 2023.3, Qodana for PHP 2023.3

Plugin:

XPathView + XSLT, 233.SNAPSHOT

Last modified: 13 July 2023