<script>;
// Update the tree and dump frames
function RefreshViews(Number)
{
// shows and sorts selected packet
window.parent.frames[0].LightPacket(Number);
// shows the tree view
window.parent.frames[1].LoadPacketTree(Number);
// shows the dump view
window.parent.frames[2].LoadPacketDump(Number,1,0);
}
function LightPacket(Number)
{
//DisplayTransformedXML(Number, "test-psml.xml", "XslIndex.xsl"
DisplayTransformedXML(Number, "0624-s.xml", "XslIndex.xsl"
}
LightPacket(1);
</script>;
</body>;
</html>;
///////LoadXML.js
function DisplayTransformedXML(Number, XMLFile, XSLFile)
{
BrowserName = navigator.appName;
Version = navigator.appVersion; // Version is not used in the following code
if (BrowserName == "Netscape"
{
var XMLHTTPRequest;
var XSLStyleSheet;
var XSLProcessor;
var XMLSource;
// Load the XML source file
XMLHTTPRequest = new XMLHttpRequest();
XMLHTTPRequest.open("GET", XMLFile, false);
XMLHTTPRequest.send(null);
XMLSource = XMLHTTPRequest.responseXML;
// Load the XSL style sheet
XMLHTTPRequest = new XMLHttpRequest();
XMLHTTPRequest.open("GET", XSLFile, false);
XMLHTTPRequest.send(null);
XSLStyleSheet = XMLHTTPRequest.responseXML;
// Instantiate the XSLT processor and associate a XSL style sheet with it
XSLProcessor= new XSLTProcessor();
XSLProcessor.importStylesheet(XSLStyleSheet);
/* Code needed to debug some XML object in Mozilla */
// var Serializer= new XMLSerializer();
// window.alert( Serializer.serializeToString( xslStylesheet ) );
/* End code needed to debug some XML object in Mozilla */
// Set an optional parameter to the style sheet
XSLProcessor.setParameter(null, "selected_packet", Number);
// Transform the XML source according to the appropriate style sheet
var XMLDOMFragment = XSLProcessor.transformToFragment(XMLSource, document);
document.getElementById("IDOutputHTML".innerHTML = "";
// Print the result of the transformation into the appropriate element into the HTML page
document.getElementById("IDOutputHTML".appendChild(XMLDOMFragment);
}
else if (BrowserName == "Microsoft Internet Explorer"
{
var XSLStyleSheet;
var XMLSource;
var XSLTemplate;
var XSLProcessor;
// Load the XML source file
XMLSource = new ActiveXObject("Msxml2.DOMDocument"
XMLSource.async = false;
XMLSource.resolveExternals = false;
XMLSource.load(XMLFile);
// Load the XSL style sheet
var XSLStyleSheet= new ActiveXObject("Msxml2.FreeThreadedDOMDocument"
XSLStyleSheet.load(XSLFile);
// We cannot use the following lines, because templates must be created as 'FreeThreadedDOMDocument'
// In case we do not want to set parameters to the style sheet, we can use the code below and skip the rest
// XSLStyleSheet= document.getElementById("IDStyleSheet"
// XSLStyleSheet.async = false;
// XSLStyleSheet.resolveExternals = false;
// IDOutputHTML.innerHTML= source.transformNode(XSLStyleSheet); // This line works only in IE; the next one is equivalent and it works also in Mozilla
// document.getElementById("IDOutputHTML".innerHTML= XMLSource.transformNode(XSLStyleSheet);
// Instantiate the XSLT processor and associate a XSL style sheet with it
XSLTemplate= new ActiveXObject("Msxml2.XSLTemplate");
XSLTemplate.stylesheet= XSLStyleSheet;
XSLProcessor= XSLTemplate.createProcessor();
XSLProcessor.input = XMLSource;
// Set an optional parameter to the style sheet
XSLProcessor.addParameter("selected_packet", Number);
// Transform the XML source according to the appropriate style sheet
XSLProcessor.transform();
// Print the result of the transformation into the appropriate element into the HTML page
document.getElementById("IDOutputHTML").innerHTML= XSLProcessor.output;
}
}
///////capture-css.css
body,tbody
{
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
white-space: nowrap;
}
<!-- This stylesheet does not work when the capture was generated after copying/cutting elements, because -->;
<!-- the value in the PSML file does not match the position in the PDML file. -->;
<xsl:for-each select="section">;
<td>;
<!--
This code should print a 'no break space' in all the cells
However, it does not work in IE6, while it works perfectly well in Xalan.
No idea why
-->;
<!--
<xsl:text disable-output-escaping="yes">;&nbps;</xsl:text>;
-->;
<xsl:if test="position()=1">;
<img src="pktindex.png"/>;
</xsl:if>;