Don't you have to do something different in various browsers? I seem to recall having to last time I used XSLTs in the browser (which was, admittedly, a while ago). In IE, it was along the lines of

element.set('html', xmlDocument.transformNode(xsltDocument))

whereas in Fx, it was a bit more convoluted:

var processor = new XSLTProcessor();
processor.importStylesheet(xsltDocument);
var resultDocument = processor.transformToFragment(xmlDocument, document);
element.appendChild(resultDocument);

As I say, though, the last time I was transforming XML documents with XSLTs in the browser was quite a while ago.

Your best bet is probably to read through the documentation at Mozilla: https://developer.mozilla.org/en/Using_the_Mozilla_JavaScript_interface_to_XSL_Transformations

On 5/06/2010 4:05 AM, André Fiedler wrote:
Hm, hadn´t tested this yet. But in your case i would try to figure out at what point it fails. Try to set xml/xsl directly via javascript and check if this works.

$(id).set('html', '<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="page1.xsl"?>
<table>
<id>blabla</id>
<designation>blablab</designation>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="/">
<html>
<body>
<table id="tableName" border="1" cellspacing="0" cellpadding="0"
width="662">');

......

btw, responseTree is a element TREE (no html string!) maybe that´s the problem? Try responseTree.inject($(id)) or so. Or try $(id).set('html', responseHTML);

Just my thoughts, no guaranty! ;o)

2010/6/4 Nelson "Icebox" Carvalho <[email protected] <mailto:[email protected]>>

    Hello everyone,

    Im having a problem loading a xml with a stylesheet associated.
    Im doing a request, and setting the html of a div to be the
    responseText of the request, but no matter what i do, i never get the
    xls load into to the xml, only the xml data.

       var XMLFILELoader = new Request({
           url: htmlToLoad,
           method: 'post',
           link: 'chain',
           onSuccess: function(responseTree, responseElements,
    responseHTML, responseJavaScript){
               $(id).set('html', responseTree);
           }
       }).send();

    if i view the xml in the browser it display correctly, with the xls
    applied.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="page1.xsl"?>
    <table>
    <id>blabla</id>
    <designation>blablab</designation>

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
    Transform">
    <xsl:template match="/">
    <html>
    <body>
    <table id="tableName" border="1" cellspacing="0" cellpadding="0"
    width="662">

    anyone ever tried this?

    All help apreciated.




--
Not sent from my Apple πPhone

Reply via email to