Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

XSLT 2.0

For users

Although XSLT 2.0 is not supported natively in Firefox, it is possible, via Saxon-B to perform XSLT 2.0, either as a regular user using the XSL Results extension, or within one's own extensions using the approach taken in its code (see below).

The extension author hopes to soon add support for having XSLT performed automatically when visiting a page containing a processing instruction for XSLT (and which was not already performed by Firefox's own 1.0 XSLT processor).

For developers

While it is possible to use the approach taken in the extension's code to add XSLT 2.0 support to one's own extension (or also Saxon-B's XQuery or XPath), at this time, it is fairly complicated, especially if one is not familiar with Java, due largely to the fact that there is a bug in LiveConnect with try-catch blocks, thus necessitating one to write one's own Java wrapper classes rather than to rely on JavaScript's own try-catch blocks (otherwise, the code might fail upon encountering a Java exception and be unusable again until restart).

If the bug is not fixed, in order to expose the full API, one would need to rewrite at least all of the public classes, handling exceptions on the Java side and returning an error string or object so that the JavaScript side could deal with any errors in XSLT (or XQuery) processing. However, a wrapper (or a direct rewrite of the Saxon code) would also need to take into account that if a method would return a given object, that object should also be a wrapped object so that it can also return error messages, in the event that the JavaScript tries to act on the Java object and an exception is returned.

Also, perhaps due to lagging Java support on the Mac, the code currently does not work on the Mac. However, if someone familiar with Java can try compiling Saxon-B completely in Java 5 (rather than its current mixture of JDK 1.4 and 5, the Saxon-B library author suggests this might solve the problem--any Java developers would be most welcome to help me (the XSL Results extension author) fix this). (You can leave a message on the discussion page.)

文档标签和贡献者

 此页面的贡献者: ziyunfei, Freeopen
 最后编辑者: ziyunfei,