Frog recommendation: Use the XSLT style sheet on the client to convert XML documents
I have not provided the source XML document and the two XSLT style sheets. You can write them yourself.
<HTML>
<Head>
<Style type = "text/CSS">
Body {font-family: tahoma, verdana, Arial, sans-serif; font-size: 14px}
. Head {font-family: tahoma, verdana, Arial, sans-serif; font-size: 18px; font-weight: bold}
</Style>
<Script language = "jscript">
<! --
Function transformfiles (strstylesheetname ){
// Obtain the data layer that displays the Conversion Result
VaR objresults = Document. All ['divresult'];
// Create two objects
VaR objxml = new activexobject ('msxml2. domdocument.3.0 ');
VaR objxsl = new activexobject ('msxml2. domdocument.3.0 ');
// Set two attributes
Objxml. validateonparse = true;
Objxsl. validateonparse = true;
// Load the XML document and check for errors
Objxml. Load ('tables _ data. xml ');
If (objxml. parseerror. errorcode! = 0 ){
// If error 9 is returned, the operation is terminated and an error is displayed.
Objresults. innerhtml = showerror (objxml)
Return false;
}
// Load the style sheet and check for errors
Objxsl. Load (strstylesheetname );
If (objxsl. parseerror. errorcode! = 0 ){
// If an error occurs, the system displays the error and terminates the program.
Objresults. innerhtml = showerror (objxsl)
Return false;
}
// If no error exists, perform the conversion.
Strresult = objxml. transformnode (objxsl );
// Display the conversion result at the display result layer.
Objresults. innerhtml = strresult;
Return true;
}
Function showerror (objdocument ){
// Create an error message
VaR strerror = new string;
Strerror = 'invalidxml file! <Br/>'
+ 'File URL: '+ objdocument. parseerror. url +' <br/>'
+ 'Line No.: '+ objdocument. parseerror. Line +' <br/>'
+ 'Character: '+ objdocument. parseerror. linepos +' <br/>'
+ 'File position: '+ objdocument. parseerror. filepos +' <br/>'
+ 'Source text: '+ objdocument. parseerror. srctext +' <br/>'
+ 'Error code: '+ objdocument. parseerror. errorcode +' <br/>'
+ 'Description: '+ objdocument. parseerror. Reason
Return strerror;
}
// -->
</SCRIPT>
</Head>
<Body onload = "transformfiles ('tables _ list. XSL ')">
<P> <SPAN class = "head"> use the XSLT style sheet on the client to convert XML documents </span> </P>
View Details & nbsp; <button onclick = "transformfiles ('tables _ catalog. XSL ')"> contents </button>
& Nbsp; or & nbsp; <button onclick = "transformfiles ('tables _ list. XSL ')"> simple list </button>
<HR/>
<! -- Insert XML and XSLT conversion results in this layer -->
<Div id = "divresults"> </div>
</Body>
</Html>