/* XsltParser - a jQuery plugin
 *
 * Making use of XSLT templates
 *
 * version 1.0
 * Author: Björn Wikström, bjorn.wikstrom@gmail.com
 * License: GNU LGPL <http://www.gnu.org/licenses/lgpl.html>
 * Copyright (c) 2010, Björn Wikström <bjorn.wikstrom@gmail.com>
 */
(function(a){a.fn.xsltParser=function(c){if(!c||!c.xml||!c.xslt){throw ("Missing required options")}this.options={xml:false,xslt:false,onSend:function(){},onStart:function(){},onComplete:function(){}};for(prop in this.options){if(c[prop]){this.options[prop]=c[prop]}}var b=this;this._container=a(this);this._xmlDocument=false;this._xsltDocument=false;this.fetch=function(d){return a.ajax({async:false,url:d,dataType:"application/xhtml+xml",beforeSend:b.options.onSend(d)}).responseXML};this.run=function(d,e){if(window.ActiveXObject){return d.transformNode(e)}else{if(document.implementation){var f=new XSLTProcessor();f.importStylesheet(e);return f.transformToFragment(d,document)}else{throw ("Browser does not support XSLT transformation")}}};this.init=function(e,d){b._xmlDocument=b.fetch(e);b._xsltDocument=b.fetch(d)};this.start=function(){b.options.onStart();b.init(b.options.xml,b.options.xslt);var d=b.run(b._xmlDocument,b._xsltDocument);b.html(d);b.options.onComplete()};this.start()}})(jQuery);
