Why is this an issue?

This is a template rule. It allows defining custom HTML checks using XPath expressions. Create a custom rule from this template to specify the XPath query and optional file filter.

Issues are raised depending on the return value of the XPath expression:

The HTML DOM used for evaluation is wrapped in a synthetic root node. Use descendant expressions such as //img rather than absolute paths such as /html/body/img.

Noncompliant code example

<img src="hero.png">

With expression: //img[not(@alt)]

<img src="hero.png" alt="Homepage hero image">
<script src="analytics.js"></script>

With expression: count(//script) > 0

<p>Static page without scripts</p>