Implicit type conversion
Reports implicit conversions between the predefined XPath-types STRING
, NUMBER
, BOOLEAN
, and NODESET
. Helps to write XSLT scripts that are more expressive about types and prevents subtle bugs:
Example:
is not the same as
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:
Enable or disable implicit conversions between certain types
Always report explicit conversions that do not result in the actually expected type, for example,
<xsl:if test="number(foo)" />
Ignore conversion from
NODESET
toBOOLEAN
by using thestring()
function as a shortcut for writingstring-length() > 0
.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
ImplicitTypeConversion- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection options
Here you can find the description of settings available for the Implicit type conversion inspection, and the reference of their default values.
- To STRING
None
- To NUMBER
None
- To BOOLEAN
None
- Always flag explicit conversion to unexpected type
Default: Selected
- Ignore conversion of NODESET to BOOLEAN by string()-conversion
Default: Selected
Inspection Details | |
---|---|
By default bundled with: | CLion 2024.3, DataGrip 2024.3, IntelliJ IDEA 2024.3, JetBrains Rider 2024.3, PhpStorm 2024.3, Qodana for .NET 2024.3, Qodana for JVM 2024.3, Qodana for PHP 2024.3, |
Can be installed with plugin: | XPathView + XSLT, 243.23140 |