https://stackoverflow.com/questions/70713636/is-an-anchor-element-required-to-have-included-text

https://amberwilson.co.uk/blog/are-your-anchor-links-accessible/#accessibility-check

It's valid, but you could also add a blank space like:

<p>some text <a name="anchor47">&nbsp;</a> and further text</p>

or you can add text and set the font-size to 0

<p>some text <a name="anchor47" style="font-size:0">anchors away!</a> and further text</p>