Santry Technology Solutions, Content Management, DotNetNuke, SharePoint Consulting
Register | Login
Wednesday, January 07, 2009

Sections
  
About Us
  
Partners
Downloads
  
 WWWCoder.com Resource Directory

Client-Side XML / XSL Transformation
9/24/2004 3:51:46 PM

Simple function for taking XML and XSL from text boxes and transforming the results in the DIV tag. All processing is done in the browser (IE).


<table width="100%">

<tr><td></td>

<td><h1>Transform XML/XLS</h1>

<form name="MyForm">

<table>

<tr>

<td align="center"><STRONG>XML</STRONG></td>

<td align="center"><STRONG>XSL</STRONG></td>

</tr>

<tr>

<td>

<textarea name="xml1" cols="70" rows="10"></textarea>

</td>

<td>

<textarea name="xml2" cols="70" rows="10"></textarea>

</td>

</tr>

<tr>

<td><input type="button" name="transform"

value="Transform XML" onClick="transFormXML()"></td>

</tr>

</table>

</form>

<div id="display" name="display"></div>

</td>

</tr>

</table>

<script>

var xslDoc = new ActiveXObject("Microsoft.XMLDOM");

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");



function transFormXML(){

var divDisplay = document.getElementById("display");

xmlDoc.async = false;

xmlDoc.loadXML(document.MyForm.xml1.value);

if (xmlDoc.parseError !=0) alert(xmlDoc.parseError.reason);

xslDoc.async = false;

xslDoc.loadXML(document.MyForm.xml2.value);

if (xslDoc.parseError !=0) alert(xslDoc.parseError.reason);

divDisplay.innerHTML = xmlDoc.transformNode(xslDoc);

}



</script>




Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970