Does translator support XSLTProcessor?

I found a database use XML and XSL to generate reference HTML. Does translator support XSLProcessor?
  • No. But couldn't you just import the data from the XML? The XSL would just handle transormation which you don't need from import.
  • @adamsmith I can get fields from the XML, but it contains thesis, article, patent. I hope I can get the information in a better way.
  • @adamsmith Is there somewhere an issue or some text explaining a reason ? XSLT is an efficient and powerful language to deal with XML format import.
  • I still don't quite understand what you need XSLT for? XSLT is a transformation language, which I don't really see Zotero has any need for. For import, Zotero has excellent support for xpaths, which were specifically designed for *parsing* XML, which is what Zotero import translators do. I think technically Zotero javascript engine would allow an XSLT processor to run, though not (at least not currently) in translators.
  • edited June 15, 2023
    Real case: I’m working on the XML/TEI export translator. Titles or notes allow rich text formatting in HTML. HTML namespace and TEI namespace are different. The actual translator deal with regex for titles, that could create XML malformations if elements are really appen to the dom
    This way is not safe for all the html elements supported in notes (that a TEI consumer will be happy to have in his namespace).

    Someone has probably thought about XSLT interdiction, there is surely a good reason, I’m curious of this reason.
  • I don't think anyone has thought about this, no, it has never come up as a serious use case. Tbh, I haven't actually tested what happens if you try to run in a translator -- I assume some of it is blocked by the translator sandboxing, though.
  • [JavaScript Error: "XSLTProcessor is not defined" {file: "chrome://zotero/content/xpcom/translation/translate_firefox.js line 425 > eval" line: 72}]
  • edited June 15, 2023
    Interesting. I’m not familiar with those kind of execution environment (eval ?).
  • Not exactly on point, but why don't you just export references as Zotero RDF (which is serialised as XML) and run XSLT on this output? I use the opposite direction to prepare bibliographic data from TEI files for import into Zotero. The mapping required quite some tinkering but the resulting XSLT will make writing the reverse operation much easier:
  • edited June 17, 2023
    I done it for a project.
    The zotero group
    The bibliography

    This is a good way for a complete library with an internal structure, but for an item, my idea was to improve the existing TEI translator for my users.

    Yous seems to have lots of skills, are you interested to join the project of improving the default TEI.js export translator for Zotero ?

    I know my cases, but not those of others. If you had a set of zotero records, we could put them in a public zotero group. Goal of code is to export them as your desired TEI <biblStruct>.

    By the way, if XSLT was available inside zotero, you would be able to include your XSLT importers (<biblStruct> -> json -> zot db).
Sign In or Register to comment.