[Xsltforms-support] The transform() function and Safari (a problem and a workaround)
Brought to you by:
alain-couthures
From: C. M. Sperberg-M. <cm...@bl...> - 2016-04-13 02:09:06
|
[This mail seems to have gone missing somewhere between my outbox and the mailing list, so I am sending it a second time. Apologies for any duplication.] A few weeks ago, I ran into an issue with the transform() function in an XForm I wrote; since I think I have now found a solution (or at least a workaround), it may be worth reporting here. With luck, anyone else who has this problem will find the posting via a Web search. Symptom: when the transform() function is invoked in Safari (or in older versions of Chrome), the form emits an error alert (a modal dialog box) reading "TypeError: null is not an object (evaluating 'resultDocument.documentElement')". No result from the transform is visible. This problem arises with all versions of Safari I have tested (5.1.10 on an old machine, 9.0.1 on a newer machine) and older versions of Chrome (30, on the old machine). It does not arise in Firefox, Opera, or newer versions of Chrome (49). It also does not arise if in another tab I visit another page that uses the same stylesheet on a static document. Nor does it arise with all uses of the transform() function. This turns out to be a clue. A few hours of experimentation eventually showed me that the stylesheet being used had an xsl:import instruction, and a comparable form that worked properly in Safari used a simpler stylesheet, with no imports or includes. When I suppressed the xsl:import, the stylesheet started to work properly. (Once I managed to persuade Safari to clear its cache, that is.) So it appears that: in Safari and older versions of Chrome, the transform() function does not deal well with XSLT stylesheets that import (or include, probably, but I didn't look into it) other stylesheets. The obvious workaround is: make any stylesheet used by transform() a standalone stylesheet. (Or I suppose you could forbid your users to use Safari. My user, on the other hand, refuses to stop using Safari, and since he shares my desk, I can't just ignore him.) I have added a note on this topic to the discussion of the transform() function in the XSLTForms wikibook [1]. [1] https://en.wikibooks.org/wiki/XSLTForms/The_transform_function Regards, Michael Sperberg-McQueen -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net **************************************************************** |