views:

341

answers:

1

For whatever reason, I can't get XSLTProcessor() to work all the time.

Here is my JS:

... xsltProcessor = new XSLTProcessor();
  xsltProcessor.importStylesheet(xmlRequest.responseXML);
  // Pass variables
  xsltProcessor.setParameter(null, "sectionNumber", section);
  xsltProcessor.setParameter(null, "entryNumber", elementNo);

  // Transform XML using XSL
  var resultDocument = xsltProcessor.transformToFragment(phonebookDump,document);
  // Append to document
  document.getElementById('three').appendChild(resultDocument);

Works fine in: Firefox on OSX, iPhone Simulator on OSX, Safari on OSX

Doesn't work at all in: Mobile Safari on iPhone, Safari on Windows

Am I missing something? Is there a workaround to XSLTProcessor()?? Would server-side XSLT processing be quicker for mobile development anyways?

+1  A: 

I'm pretty sure Mobile Safari doesn't support XSLT, as the underlying OS X implementation does not include the relevant libraries that are present in desktop versions of OS X.

Server-side processing would definitely be quicker for a mobile app anyway: any processing you can reasonably shift away from the phone to the server is a win.

NickFitz