There are several ways to load XSL and XML:
1. Client loading (javascript)
<Html>
<Body>
<Script type = "text/javascript">
Var xmlDoc = null;
If (window. ActiveXObject)
{
// Code for IE
XmlDoc = new ActiveXObject ("Microsoft. XMLDOM ");
}
Else if (document. implementation. createDocument)
{
// Code for Mozilla, Firefox, Opera, etc.
XmlDoc = document. implementation. createDocument ("", "", null );
}
Else
{
Alert ('your browser cannot handle this script ');
}
If (xmlDoc! = Null)
{
XmlDoc. async = false;
XmlDoc. load ("cd_catalog.xml ");
Document. write ("<table border = '1'> ");
Var x = xmlDoc. getElementsByTagName ("CD ");
For (I = 0; I <x. length; I ++)
{
Document. write ("<tr> ");
Document. write ("<td> ");
Document. write (
X [I]. getElementsByTagName ("ARTIST") [0]. childNodes [0]. nodeValue );
Document. write ("</td> ");
Document. write ("<td> ");
Document. write (
X [I]. getElementsByTagName ("TITLE") [0]. childNodes [0]. nodeValue );
Document. write ("</td> ");
Document. write ("</tr> ");
}
Document. write ("</table> ");
}
</Script>
</Body>
</Html>
2. server load (Asp.net)
<% @ Control Language = "c #" %>
<% @ Import Namespace = "System. Xml" %>
<% @ Import Namespace = "System. Xml. Xsl" %>
<% @ Import Namespace = "System. Xml. XPath" %>
<Script runat = "server" language = "c #">
Public string xmlSource, writable source;
Void Page_Load (){
XmlDocument docXml = new XmlDocument ();
DocXml. Load (Server. MapPath (xmlSource ));
Inclutransform docXsl = new inclutransform ();
DocXsl. Load (Server. MapPath (program source ));
DocXsl. Transform (docXml, null, Response. Output );
// Chapter. Text = docXml. TransformNode (docXsl );
}
</Script>