/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk

« back to all changes in this revision

Viewing changes to js/xml.js

  • Committer: Suren A. Chilingaryan
  • Date: 2008-12-06 01:38:28 UTC
  • Revision ID: csa@dside.dyndns.org-20081206013828-lm3jqpc4fizd6cn7
XML+XSLT modules support, Alarms support in frontend (mozilla only)

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
    }
182
182
}
183
183
 
184
 
 
185
 
function xsltHandler(xsltdoc, xattr) {
186
 
    xattr.xslt_processor.importStylesheet(xsltdoc);
 
184
function xsltApply(xsltproc, xmldoc, place) {
 
185
    if (typeof place == "string") {
 
186
        place = document.getElementById(place);
 
187
        if (!place) {
 
188
            adei.ReportError(translate("Node %s is not found", place));
 
189
            return;
 
190
        }
 
191
    }
 
192
    
 
193
    var htmldoc;
 
194
    
 
195
    if (typeof XSLTProcessor != "undefined") {  
 
196
        htmldoc = xsltproc.transformToFragment (xmldoc, document);
 
197
        if (place) {
 
198
            place.innerHTML = "";
 
199
            place.appendChild (htmldoc);
 
200
        }
 
201
    } else if (typeof xmldoc.transformNode != "undefined") { 
 
202
        htmldoc = xmldoc.transformNode(xsltproc);
 
203
        if (place) {
 
204
            div.innerHTML = htmldoc;
 
205
        }
 
206
    } else {
 
207
        adei.ReportError(translate("Browser is not supporting XSL transform"));
 
208
    }
 
209
    
 
210
    return htmldoc;
 
211
}
 
212
 
 
213
function xsltHandler(xsltdoc, xattr, error) {
 
214
    if (error) {
 
215
        xattr.handler(null, xattr.attr, error);
 
216
        return;
 
217
    }
 
218
    
 
219
    if (typeof XSLTProcessor != "undefined") {  // Mozilla, Opera, Safari
 
220
        xattr.xslt_processor = new XSLTProcessor();
 
221
        xattr.xslt_processor.importStylesheet(xsltdoc);
 
222
    } else  {  // IE or unsupported
 
223
        xattr.xslt_processor = xsltdoc;
 
224
    }
 
225
 
187
226
    xattr.handler(xattr.xslt_processor, xattr.attr);
188
227
}
189
228
 
192
231
 
193
232
    xattr.attr = attr;
194
233
    xattr.handler = handler;
195
 
    xattr.xslt_processor = new XSLTProcessor();
196
234
 
197
235
    loadXML(url, xsltHandler, xattr);
198
236
}