Code Inspections in XPath
This topic lists all JetBrains Rider code inspections available in XPath.
You can toggle specific inspections or change their severity level on the Editor | Inspection Settings | Inspection Severity | Other Languages page of the IDE settings Ctrl+Alt+S.
Inspection | Description | Default Severity |
---|---|---|
Hardcoded namespace prefix | Reports comparisons of the
<xsl:if test="name() = 'xlink:href'">...<xsl:if>
Powered by XPathView + XSLT-Support | |
Implicit type conversion | Reports implicit conversions between the predefined XPath-types
<xsl:if test="foo" />
is not the same as
<xsl:if test="string(foo)" />
The first test checks whether the element "foo" exists (count(foo) > 0) ; the latter one however is only true if the element actually contains any text (string-length(foo) > 0 ). Suggests making the type conversion more explicit. Use the following options to configure the inspection:
| |
Redundant type conversion | Reports unnecessary type conversions. Type conversions are unnecessary when the argument type of a | |
Unknown element or attribute name | Reports names of elements or attributes that are used in an XPath-expression but are missing in the associated XML files and are not defined in the referenced schemas. Such names are often the result of typos and would otherwise probably only be discovered at runtime. Example:
<xsl:template match="h:txtarea" />
If the h is bound to the XHTML namespace, the inspection will report this part of the match expression as an unknown element name because the correct name of the element is "textarea". Powered by XPathView + XSLT-Support | |
XPath predicate with index 0 | Reports usages of
//someelement[position() = 0] or //something[0] Powered by XPathView + XSLT-Support |