Hi Eric,

Running Safari 3.1, this produces no output, when entered at http://www.w3schools.com/xsl/tryit.asp?filename=cdcatalog :

<html>
<head>
<script>
function loadXMLDoc(fname)
{
var xmlDoc;
  xmlDoc=document.implementation.createDocument("","",null);

xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}

function displayResult()
{
xml=loadXMLDoc("cdcatalog.xml");
xsl=loadXMLDoc("cdcatalog.xsl");
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("example").appendChild(resultDocument);
}
</script>
</head>
<body onload="displayResult()">
<div id="example" />
</body>
</html>

Best,
Pierre.

On 17 Feb 2008, at 15:49, Eric Seidel wrote:

Safari 3.0 and later supports XSLTProcessor.

You can use that.  The FAQ is wrong:
http://developer.apple.com/internet/safari/faq.html#anchor21

Perhaps one of the Apple guys on this list can get it fixed.

-eric

On Sun, Feb 17, 2008 at 2:48 AM, Pierre Bernard <[EMAIL PROTECTED]> wrote:
Hi!

I would like to display XML with an XSL transformation.

I know the easy way is to have an iframe point at the XML. Here the
XML needs to refer to the XSL.
That's precisely what I want to avoid. I don't want the XML to know
about the XSL as I want it to be used with several different XSL
transformations.

An initial search brought me to this: http://www.w3schools.com/xml/xml_xsl.asp
However, it turns out that WebKit does not support JavaScript access
to XSL transformations. So this seems like a dead end.

I have since found a better implementation: 
http://johannburkard.de/software/xsltjs/
Still this does not work with WebKit. However the developer gives an
interesting tidbit on his blog:
I experimented with transforming XML in an <iframe>. Extending the
XML with an xml-stylesheet processing instruction and loading it in
a hidden <iframe> is probably enough to make Safari support
programmatic XSLT. What I will try now is to extend xslt.js with the
corresponding code.

If I understand this right, he found a way to inject the XSL
stylesheet reference into the XML using JavaScript. That would be a
perfect solution for WebKit use. (For other browsers I would still
need the xslt.js)

The think is that I don't know how to manipulate the XML that goes
into the iframe. Ideas?


Best,
Pierre

---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com




_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev



---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to