xslint checks

49 checks available

Check Type Severity Description
template-match-are-you-confusing-variable-and-node xpath warning A variable name is used bare as a node selector. Use $name syntax to reference the variable.
template-match-blank-nested-if xpath warning A nested xsl:if inside another xsl:if is prohibited. Combine conditions with 'and' into a single xsl:if.
template-match-can-use-abbreviated-axis-specifier xpath warning Verbose axis specifiers child::, attribute::, or parent::node() are used. Replace them with the node name alone, @, or .. respectively.
template-match-duplicate-param-name xpath error Two xsl:param siblings share a @name. Each parameter of a template, function, or stylesheet must have a distinct name.
template-match-duplicate-with-param-name xpath error A single call passes two xsl:with-param with the same @name. Each parameter can be supplied only once.
template-match-empty-content-in-instructions xpath warning An instruction element such as xsl:for-each, xsl:if, or xsl:when has no content. Add content or remove the empty element.
template-match-empty-variable xpath warning An empty xsl:variable binds the empty string for no reason. Give it a @select or some content, or remove it.
template-match-function-template-complexity xpath warning The function or template contains more than 50 XSLT elements. Split it into smaller, focused units.
template-match-function-template-is-not-child-of-stylesheet xpath error 'xsl:function' or 'xsl:template' are used in the wrong places. Use 'xsl:function' and 'xsl:template' as child nodes of 'xsl:stylesheet'.
template-match-function-use-in-xslt-1 xpath error 'xsl:function' is declared in XSLT version 1.0. Use a named template or upgrade the stylesheet version to 2.0 instead.
template-match-incorrect-use-of-boolean-constants xpath warning Boolean constants 'true' and 'false' are non-empty strings, not booleans. Use true() and false() instead.
template-match-missing-id-in-stylesheet xpath warning The '@id' attribute is missing in the 'xsl:stylesheet' element. Declare it to specify the unique identifier explicitly.
template-match-missing-version-in-stylesheet xpath warning The '@version' attribute is missing in the 'xsl:stylesheet' element. Declare it to specify the stylesheet version explicitly.
template-match-monolithic-design xpath warning The stylesheet contains only one template or function. Extract logic into separate, focused templates.
template-match-name-starts-with-numeric xpath warning A variable, function, or template name starts with a digit, which is invalid in XPath. Rename it to start with a letter.
template-match-not-creating-element-correctly xpath warning xsl:element is used with a static name. Use a literal result element instead.
template-match-not-using-attribute-test-in-if-when-node xpath error 'xsl:if' or 'xsl:when' don't have attribute @test. Add this attribute or delete node.
template-match-not-using-output xpath error The xsl:output instruction is missing. Declare it to specify the serialization format explicitly.
template-match-not-using-schema-types xpath warning No built-in Schema types are used in XSLT 2.0 mode. Declare variable types with xs:string, xs:integer, or similar.
template-match-null-output-from-stylesheet xpath warning The root template contains only variable declarations and produces no output. Add instructions that write to the result tree.
template-match-output-method-xml xpath warning xsl:output declares method='xml' while the root template generates HTML elements. Change the method to 'html'.
template-match-redundant-namespace-declarations xpath warning The xsl:stylesheet declares a namespace prefix that is never used. Remove the redundant xmlns declaration.
template-match-setting-value-of-variable-incorrectly xpath warning A variable is assigned via a nested xsl:value-of instead of the select attribute. Use select syntax instead.
template-match-short-names xpath warning A variable, function, or template has a single-character name. Use a descriptive name that reveals intent.
template-match-starts-with-double-slash xpath warning The match attribute of xsl:template starts with //, which scans the entire document tree. Use a more specific pattern.
template-match-stylesheet-has-no-templates xpath error The stylesheet has no xsl:template elements and produces no output. Add at least one template.
template-match-template-has-no-name-or-match xpath error An 'xsl:template' must have a '@match' or '@name' attribute, or both. Add one of them.
template-match-template-without-match-have-mode-or-priority xpath error An xsl:template that has no match attribute must have no mode attribute and no priority attribute. Add match attribute or remove mode or priority.
template-match-text-outside-xsl-text xpath warning Literal text appears directly inside an 'xsl:' instruction element. Wrap it in 'xsl:text'.
template-match-too-many-small-templates xpath warning The stylesheet has 10 or more templates with fewer than 3 child elements. Merge related small templates to reduce fragmentation.
template-match-unsorted-imports xpath warning The 'xsl:import' elements are not sorted alphabetically by '@href'. Sort imports to improve readability.
template-match-unused-function-template-parameter xpath warning A parameter is declared but never referenced in the function or template body. Remove it or use it.
template-match-unused-function xpath warning A stylesheet function is never called in any match or select expression. Remove it or call it.
template-match-unused-variable xpath warning A variable is declared but never referenced by $name in the stylesheet. Remove it or use it.
template-match-use-choose-without-otherwise xpath warning xsl:choose has no xsl:otherwise branch. Add xsl:otherwise to handle unmatched cases explicitly.
template-match-use-double-slash xpath warning The match attribute of xsl:template contains //, which triggers a full document scan. Use a more specific path.
template-match-use-node-set-extension xpath warning The node-set() extension function is unnecessary in XSLT 2.0. Query the variable directly without it.
template-match-use-single-option-for-choose xpath warning xsl:choose contains only one xsl:when branch. Replace it with xsl:if.
template-match-using-disable-output-escaping xpath warning disable-output-escaping='yes' is set, which produces implementation-defined output. Use xsl:copy-of or literal elements instead.
template-match-using-namespace-axis xpath warning The namespace:: axis is deprecated in XSLT 2.0. Use fn:in-scope-prefixes() and fn:namespace-uri-for-prefix() instead.
template-match-using-not-outermost-stylesheet xpath error xsl:stylesheet is nested inside another element. It must be the outermost element of the document.
template-match-variable-or-param-have-select-and-internal-content xpath error An xsl:variable or xsl:param has both a select attribute and a non-empty body. Use only one way to set the value.
template-match-variable-or-param-without-name xpath error xsl:variable and xsl:param require a @name attribute. Add one or remove the element.
template-match-with-param-use-in-invalid-parent-node xpath error xsl:with-param is allowed only within xsl:call-template, xsl:apply-templates, xsl:apply-imports, xsl:next-match and xsl:next-iteration.
template-match-with-param-without-name xpath error xsl:with-param requires a @name attribute to bind the parameter it passes. Add one.
template-match-unused-named-template corpus warning A named template is never invoked via xsl:call-template. Remove it or call it.
invalid-xpath-expression validation error An XPath expression is malformed and cannot be parsed. Fix its syntax.
malformed-stylesheet validation error The stylesheet is not well-formed XML and cannot be parsed. Fix its syntax.
redundant-whitespace format warning An XPath expression has redundant whitespace. Remove the extra spaces.