| Subject: Re: [xsl] Opera's JavaScript API for XSLT? From: "M. David Peterson" <m.david@xxxxxxxxxx> Date: Fri, 22 Sep 2006 17:44:34 -0600 | 
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;
};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();
 }M. David Peterson wrote:Hey Robert,
Robert Koberg wrote:Hi,WOW! I hadn't realized how big Dojo had become. I've got the repository checked out. Where can I find your extensions?
I have added some XSL transformation conveniences to the dojo toolkit (http://dojotoolkit.org - you would need to use SVN and get the trunk)
Dojo is pretty cool :) Docs kinda suck. The dojo.xml.XslTransform class is in: dojo/src/xml. Be sure to check out dojo/tests/xml/test_XslTransform.html for some different uses.
Basically, the public API (I am open to change or extend it to make it more useful) looks like:
dojo.xml.XslTransform = function(/*String*/ xsltUri) {
/*
Common params:
xmlDoc - the primary XML source
params - a 2 dim array, e.g. [[name, value]] which is cleared after each transform
parentDoc - the window.document that is the parent of the result
*/
this.getResultString = function(/*XMLDOcument*/ xmlDoc, /*2 Dimensional Array*/params, /*HTMLDocument*/parentDoc)
/*
contentPane - dojo specific layout region to put the result into (instatiates child widgets)
*/
this.transformToContentPane = function(/*XMLDOcument*/ xmlDoc, /*2 Dimensional Array*/params, /*ContentPane*/contentPane, /*HTMLDocument*/parentDoc);
/*
region - some HTML element to put the result into
*/
this.transformToRegion = function(/*XMLDOcument*/ xmlDoc, /*2 Dimensional Array*/params, /*HTMLElement*/region, /*HTMLDocument*/parentDoc);
this.transformToDocument = function(/*XMLDOcument*/ xmlDoc, /*2 Dimensional Array*/params);
this.transformToWindow = function(/*XMLDOcument*/ xmlDoc, /*2 Dimensional Array*/params, /*HTMLDocument*/windowDoc, /*HTMLDocument*/parentDoc);
}
best, -Rob
-- /M:D
M. David Peterson http://mdavid.name | http://www.oreillynet.com/pub/au/2354
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Opera's JavaScript API fo, Robert Koberg | Thread | Re: [xsl] Opera's JavaScript API fo, Michael(tm) Smith | 
| Re: [xsl] Opera's JavaScript API fo, Robert Koberg | Date | [xsl] Diff of two XML's using XSLT, Guy Ellis | 
| Month |