Skip to content
Permalink
Browse files

Revert "Remove old style conversion code"

We got multiple requests from users that use custom 0.8 styles
so we'll have to keep this code for now

This reverts commit a59ce2c.
  • Loading branch information...
adomasven committed Oct 31, 2018
1 parent e526a8f commit 0bdebbd64cf17b85c47cbf30e6176c3eafe60715
Showing with 29 additions and 1 deletion.
  1. +29 −1 chrome/content/zotero/xpcom/style.js
@@ -713,7 +713,35 @@ Zotero.Style.prototype.getCiteProc = function(locale, automaticJournalAbbreviati
} else {
var version = this._version;
}
var xml = this.getXML();

if(version === "0.8") {
// get XSLT processor from updateCSL.xsl file
if(!Zotero.Styles.xsltProcessor) {
let protHandler = Components.classes["@mozilla.org/network/protocol;1?name=chrome"]
.createInstance(Components.interfaces.nsIProtocolHandler);
let channel = protHandler.newChannel(protHandler.newURI("chrome://zotero/content/updateCSL.xsl", "UTF-8", null));
let updateXSLT = Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser)
.parseFromStream(channel.open(), "UTF-8", channel.contentLength, "application/xml");

// load XSLT file into XSLTProcessor
Zotero.Styles.xsltProcessor = Components.classes["@mozilla.org/document-transformer;1?type=xslt"]
.createInstance(Components.interfaces.nsIXSLTProcessor);
Zotero.Styles.xsltProcessor.importStylesheet(updateXSLT);
}

// read style file as DOM XML
let styleDOMXML = Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser)
.parseFromString(this.getXML(), "text/xml");

// apply XSLT and serialize output
let newDOMXML = Zotero.Styles.xsltProcessor.transformToDocument(styleDOMXML);
var xml = Components.classes["@mozilla.org/xmlextras/xmlserializer;1"]
.createInstance(Components.interfaces.nsIDOMSerializer).serializeToString(newDOMXML);
} else {
var xml = this.getXML();
}

try {
var citeproc = new Zotero.CiteProc.CSL.Engine(

0 comments on commit 0bdebbd

Please sign in to comment.
You can’t perform that action at this time.