[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Opera's JavaScript API for XSLT?
VERY COOL!
I've got some code that you might be interested in... It's pretty basic, but it implements a browser-based transformation DOM cache which assigns an ID to a particular DOM that has been transformed, storing the result in an array cache. It then checks the array cache before running a transformation to see if its already been run, and if yes, returns the DOM from the cache instead. I wrote this one morning who knows how long ago, and never came back to it (the name of the file alone to make that an easy point to notice ;), so without a doubt it can be improved upon, but if its something that you find useful, you can access it here > http://www.xsltblog.com/xslclient-test.js The pertinent pieces of code are, function loadXMLFeed(feedID){ var inMemory = false; var xmlFeedLength = xmlFeeds.length; var i; for (i = 0; i< xmlFeedLength; i++){ if (xmlFeeds[i][0] == feedID){ inMemory = true; return xmlFeeds[i][1]; } } if (!inMemory){ for (i = 0; i< xmlURLList.length; i++){ if (xmlURLList[i][0] == feedID){ var tempDoc = loadAtomFeed(xmlURLList[i][1]); xmlFeeds[xmlFeedLength] = new Array(feedID, tempDoc); return tempDoc; } } } return false; }; And, function checkTransformCache(target, dom, style, xmlfeed){ var inCache = false; var i; if (transformCache.length){ for (i = 0; i< transformCache.length; i++){ if (transformCache[i][0] == xmlfeed){ target.innerHTML = transformCache[i][1]; inCache = true; } } } if (!inCache){ setDOMSource(dom); setStylesheet(style); setFeedID(xmlfeed); Transform(); } }; Playing with your code now... Thanks! :D Robert Koberg wrote: M. David Peterson wrote:Hey Robert,
M. David Peterson http://mdavid.name | http://www.oreillynet.com/pub/au/2354
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|