How to request data from a Sharepoint list via XMLHTTP and pass a parameter to the XSL for processing

Requirements: make sure the MS XML parser is available on the server.
FYI: check out the client-side API in the latest Sharepoint SDK-pretty cool stuff.
I didn’t drop the links.xsl but it’s easy enough to create your own to fit your situation-just open the URL below in the browser to access the XML and locate the fields you want to render in your XSL i.e. @ows_LinkFilename"> etc. 
I developed this as part of a project to provide the ability to pull mp3 audio files stored in a sharepoint document library, group them by sub-folder (hence the need to pass parameters to the XSL for handling child lists, and wire up the Windows Media Active X player to launch the audio files from Sharepoint-all using client-side code only.  RJS.
function getLinks(){
// Load XML
var xhr = new ActiveXObject("Msxml2.XMLHTTP.3.0");
var doc = xhr.responseXML;
var xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");
var xslProc;
var nodeBook, sIdValue;
xslDoc.async = false;
if (xslDoc.parseError.errorCode != 0) {
   var myErr = xslDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   xslt.stylesheet = xslDoc;
   var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.async = false;
xmlDoc.validateOnParse = false;
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
      xslProc = xslt.createProcessor();
      xslProc.input = xmlDoc;
      var pfolder = ‘http://%5Bserveraddress%5D/sites/%5Bsitename%5D/Shared%20Documents/’;
     xslProc.addParameter("pfolder", pfolder)
return xslProc.output;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s