Validated styles suddenly deemed 'not valid'
I created two custom styles for our institute in CSL 1.0, which I'd carefully validated on Validator.nu and had successfully used as recently as yesterday.
Today, after a Firefox update (but I didn't think also a Zotero one), I went to continue editing a document with one of these styles, and Zotero gave me a pop-up window telling me the style appears not to be valid. Ditto with my other custom style.
The built-in Chicago style worked fine.
I just went back and re-validated the style on Validator.nu. Still good. Any idea what's wrong and, more important, how to fix it?
Today, after a Firefox update (but I didn't think also a Zotero one), I went to continue editing a document with one of these styles, and Zotero gave me a pop-up window telling me the style appears not to be valid. Ditto with my other custom style.
The built-in Chicago style worked fine.
I just went back and re-validated the style on Validator.nu. Still good. Any idea what's wrong and, more important, how to fix it?
IO Error: Non-XML Content-Type: text/plain.
Tried in a new document?
Validation sounds fine - the error is expected when you uncheck the "be lax..." box.
Has there been any change to the Zotero code in the last 24 hours that could've triggered this?
Could you post the style online as a public gist at gist.github.com and provide a link here (or make it accessible some other way - don't paste it here, though).
git://gist.github.com/1839131.git
TypeError: child.getAttribute is not a function" error in the Zotero Reference Test pane. Strangely, the error goes away when I put a line break between "</choose></group>".
Here's a copy that should work
https://gist.github.com/1839326
That still means there is some odd bug, but this should get you working again.
/var/tmp/FOOZXQbv9:18: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0x91 0x3C 0x2F 0x74
<term name="open-quote">‘</term>
^
So it might be an encoding issue.
Thanks again, so much!
Simon's intuition of a bug in the citeproc-js DOM parsing module was right, and Rintze's trial with and without the newline was the key that pinpointed the fault. Apparently the Firefox DOM parser places an empty Text node between the closing tags if (and only if) they are on the same line. A function in the citeproc-js DOM parsing module relies on counting the number of child nodes. It was assuming that all children it saw were meaningful DOM nodes (and not Text). It crashed because when nodes of type Text are in there, and don't have a getAttribute() method.
The fix I've applied is a little wordy in the code. The simpler approach would seem to be just to use node.normalize() to eliminate empty Text nodes ... but that didn't work. The presence of adjacent closing tags apparently wakes up some general Text node recognition machinery, so we get nodes with hard returns in them as well (which are not empty, and so are not dropped by normalize(). (Into the bargain, the fix applied will cut out Comment nodes in the target, which would also have broken things.)
With version 1.0.282 (just checked in), things should be handled correctly in this function regardless of line breaking in the CSL source.