Skip to content

Instantly share code, notes, and snippets.

@gosub
Created June 17, 2014 07:23
Show Gist options
  • Save gosub/c7576b0c99ffdd7e993c to your computer and use it in GitHub Desktop.
Save gosub/c7576b0c99ffdd7e993c to your computer and use it in GitHub Desktop.
A bookmarklet for applying an XSLT stylesheet to an XML document - just insert the base64 encoded xsl in atob("") - tested on firefox
javascript:(function(){var parser=new DOMParser();var ss=parser.parseFromString(atob(""),'application/xml');var xsltProcessor=new XSLTProcessor();xsltProcessor.importStylesheet(ss);var newdoc=xsltProcessor.transformToDocument(content.document);var myWindow=window.open("data:text/html,"+encodeURIComponent(newdoc.documentElement.innerHTML),"_blank","");myWindow.focus();}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment