QUIS
LEGET
HAEC?

February 26th, 2012
by Robbert Broersma

<?xml-stylesheet for XSLT 2.0 in the browser

For your convenience Frameless will also be made available as frameless.xsl, in addition to the JavaScript version, so you don't always need to provide an HTML document to embed the transformation in. It works like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="dita2html.xsl" type="application/xslt+xml"?>
<?xml-stylesheet href="frameless.xsl" type="text/xsl"?>
<topic>
    ...

This way dita2html.xsl will still be the default associated stylesheet for processors that support it, while current browsers will start Frameless to view the document, since they only support the text/xsl legacy mimetype.

Forward compatibility

What if browsers start supporting the application/xslt+xml mime-type? When the browser supports just XSLT 1.0, the page will be inaccessible. When the browser supports XSLT 2.0, it will keep working unless you rely on Frameless extensions to XSLT. Worst case scenario: you'll have to move the frameless.xsl processing instruction up a line, putting it before the actual stylesheet reference.

Made in Holland, 100% JavaScriptRobbert Broersma