-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Saxon-CE engine does not perform serialization. #6
Comments
Other browser-based XSLT engines, e.g. Mozilla, have the same restriction. It’s the whole essence of Saxon-CE that it makes updates to the HTML DOM (a tree of nodes), not to the lexical HTML of the page. So no, we have no plans to change this. Using disable-output-escaping is usually not the best way to solve your problem. What problem are you trying to solve with it? Michael Kay
|
I am turning an xml-file containing 'my-own-xml' mixed with html parts into a standalone html-file that contains a working 'application' containing a lot of javascript. This javascript is added into the xslt stylesheet inside CDATA sections, but when it comes out, it should still stay unescaped, or all of the javascript will fail. I wanted to create an editor inside a webpage that would help users create this xml-file, and then be able to 'compile' and test it, right in an iframe in the same browser-window. Quite frustrating. I understand that your vision on what this project is suited for is different, but I am just looking to find a way to do full XSLT2.0 transformations inside the browser, including serialization. (This 'my-own-xml' is basically a way to describe different types of interactive questions that can be run inside a webbrowser, like gap, multiple-choice, but also drag-sort, drag-match etc. questions. Answers can be sent to the server, and this currently works like the scorm2004 standard. The fact that it can be mixed with html, allows users to basically plug anything they want into these questions, like text, tables, images, svg code, whatever, without having to code anything. My vision is that picking a region on an image is just as much a multiple choice question, as picking a word in a sentence or picking something from a list of options. The code is the same, only the markup is a bit different. Also if I want to support a new LMS API for sending the answers to the server, like for instance TinCanAPI, I just have to change the javascript inside the xslt, and regenerate the html, but the source xml containing the question doesn't have to change. Same thing if the layout changes drastically, the question will still be the same, but the end-result might look very different, so I could do way more drastic changes than just css changes). |
One more question: after the transformToDocument call, one gets a result document. Does this contain enough information to do the serialization? If that information is not there, would you be able (and willing) to add it, making it possible for someone else to write a serialization that can be run inside the browser? Or would there be another way to solve the problem I have (maybe using features of this library that I am not aware of)? |
It’s certainly possible to write your own serializer. A simple serializer can even be written in XSLT itself. A paramount objective for Saxon-CE is to minimize the size of the library, so any serializer would need to be implemented as a separate and optional library. Michael Kay
|
The question I actually wanted to ask was: 'does the result document that is produced by transformToDocument contain all information necessary to do the serialization (like disable-output-escaping="yes")'. Your answer seems to suggest that that is the case. Could you tell me where in the result tree I should look (what property?). Thanks. |
I posted code for a very basic XML serializer (that works with the result-document) coded in JavaScript at: https://saxonica.plan.io/boards/1/topics/5915 This code only handles global namespace declarations that must be set in a JS literal object, it was written to overcome issues with iOS Safari's handling of XML namespaces. If you have special serialization needs for Saxon-CE, you could possibly use this code as a starting point. |
Thank you. |
At the Restrictions page, I read:
And of course my stylesheet relies on disable-output-escaping="yes".
Any plans on adding serialization?
Also something like
seems to be unsupported, so no workaround possible?
The text was updated successfully, but these errors were encountered: