Thanks. If your data is HTML, html:parse is the correct choice. fetch:binary-doc can be used to convert a binary item to a document node [1]:
let $b64 := xs:base64Binary(<data>PHgvPg==</data>) return ( fetch:binary-doc($b64), html:parse($b64) ) [1] https://docs.basex.org/wiki/Fetch_Module#fetch:binary-doc