TransforMiix's picky validator

Firefox uses an XSLTProcessor that performs stricter validation than any validator tool I can find. It makes it really difficult to figure out what the problem is in my stylesheet when all I get is a very unhelpful message like this:

[Exception… “The URI is malformed” nsresult: “0x804b000a (NS_ERROR_MALFORMED_URI)” location: "JS frame :: chrome://cpcext/content/js/Common/make.js :: CPCExt.Common.Make.getXSLTProc :: line 1178]

The namespace URI is fine. What other URI could it be talking about?

But I’m not really looking for help with this specific error, I just give it as an example. I have thousands of lines of legacy XSLT code to deal with, which get thumbs-up from xsltproc, xml val, and the W3 validator. But TransforMiix won’t parse most of it, and I just don’t have time for the kind of trial and error I’ve seen suggested elsewhere, commenting out one line at a time and running the transform again until I stumble upon the problematic lines.

Is there, by any chance, a standalone tool that will replicate TransforMiix’s validation and give me a list of error messages so I that can run this on my stylesheets and see what lines it has a problem with? This would be a great help.

Any other suggestions would be welcome.

I found this but saw a later comment that this method no longer works.

I’m not sure about a tool (hopefully another poster will know), but if you post your code I can try to help you to figure out the specific problem.

I think it may be related to this, which I saw in my console during one of the attempts to parse and display my page:
safebrowsing.google.com/safebrowsing/downloads

When you navigate to this, google tells you the URI is malformed. But even disabling safebrowsing doesn’t seem to address the problem, so perhaps it’s not related.

I didn’t see this until too late in the day, so perhaps on Monday I could do that.

I’m grateful for your offer but my concern is, we could fix this problem only for another problem to show with the second stylesheet, and so on. Could you describe how I could go about finding the problems? Is there some better tool I could use than W3 or xml val that will show me all the errors that TransforMiix will trip over? Or is it just a matter of pouring over the xslt sheets line by line whenever I get one of it’s unhelpful error messages? That approach scares me, because of the sheer size of legacy xslt I have to work with.

I’ll say that I’ve found marginally better luck using nsIProcess to call an external xsltproc to make my xslt. I just didn’t want to have to do that, I’d rather use the processor built into the browser.

1 Like

I think I’ve figured out the issues with my stylesheet, but now I’m having a different error. I’m trying to create xhtml, but Firefox keeps seeing the result as unstyled xml.

My stylesheet has this:
<xsl:output encoding=“UTF-8” media-type=“application/xhtml+xml”/>

If the file path ends in .xhtml, I’m doing this:

var xml = document.implementation.createDocument(’’, ‘’, document.implementation.createDocumentType(“html”, “-//W3C//DTD XHTML 1.0 Strict//EN”, “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”))
xml.appendChild(xml.importNode(doc.documentElement, true))

I’m then using nsIDOMSerializer.serializeToStream to stream the document to an nsILocalFile using nsIFileOutputStream.

The file saves properly, the file extension is .xhtml, but even so, the resulting output starts with this:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=“http://www.w3.org/1999/xml”>

How do I get rid of that xmlns attribute?

Thanks!

This is a new question, so I’m just going to ask this as a new question.

No problem. Your persistence is good, excuse the delay I havent had a chance to look at this been busy. I was kind of hoping others would swoop in :stuck_out_tongue: