XSLT and XQuery on invalid html input, URI fragments look like objects
I am using Saxon 9 to parse invalid html sources. In particular, html has href values like:
<a href = "blah.asp? fn = view & g_varID = 1234"> some text </a>
I am getting errors:
"Error reported by XML parser: object reference" g_varID "must end with ';' Separator".
The xml parser reads the string "& g_varID" and complains that there should be a ";" to delineate an object. But of course this is not intended as an HTML entity - it is just a snippet of a URI.
How can I make the parser ignore it? Note. I am using non-competitive Saxon, not Saxon-SA.
a source to share
As mentioned above, this is invalid XML, this is HTML. However, this particular issue is that the default HTML is cleared: http://www.w3.org/People/Raggett/tidy/ . Use it with the following command line arguments to convert HTML to XHTML:
tidy -asxhtml foo.html > foo.xhtml
And then you should be able to run it through your XSLT.
a source to share