[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] msxml stylesheet for displaying xml tree question


Subject: RE: [xsl] msxml stylesheet for displaying xml tree question
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Mon, 05 Jan 2004 13:53:26 +0000

From: "bryan" <bry@xxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] msxml stylesheet for displaying xml tree question
Date: Mon, 5 Jan 2004 14:22:01 +0100


This is really sort of off-topic, I was thinking I might like to improve my defaultss.xsl version I have, to do some of the things I want I need to add some extension functions, one of which would be a function that finds where the xml document that the xslt is displaying is located at (remember that defaultss.xsl is a resource in the .dll) anyone have suggestions on the best way to do this? Perhaps there's some hidden objects/methods/properties exposed to the scripting environment for extension functions in msxml that someone out there knows about?



Not sure what sort of things you need. I wrote a couple of trivial extensions for IE for looking at source code etc. They are both use a skeleton provided by Microsoft. They don't modify the default stylesheet though. They might give you some ideas...
Run this reg file after copying the two files to the folders specified.


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Show XML]
@="C:\\WINNT\\Web\\ShowXml.htm"
"contexts"=hex:01

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Show XSL]
@="C:\\WINNT\\Web\\ShowXsl.htm"
"contexts"=hex:01

The two files are:
<!-- ShowXml.htm -->
<html>
<body>
<script language="JavaScript" defer>
<!--
// specific to context menu extensions
var win = external.menuArguments;
// the document object the user right-clicked on
var doc = win.document;
var sXml;
var sTitle;
// make sure our debugging window is a unique window
var wincounter = 0;

var mywin = window.open("about:blank", "source" + wincounter++, "toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
while (mywin == null)
{
mywin = window.open("about:blank", "source" + wincounter++, "toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
} // if (mywin == null)


var myDoc = mywin.document;

myDoc.open("text/plain");
if (doc.XMLDocument)
{
 sXml = doc.XMLDocument.xml;
 sTitle = "XML for: " + win.location.href;
}
else
{
 sXml = "No XML data found for document.";
 sTitle = "No XML for: " + win.location.href;
}
myDoc.write(sXml);
myDoc.close();
myDoc.title = sTitle;

// -->
</script>
</body>
</html>

AND

<!-- ShowXsl.htm -->
<html>
<body>
<script language="JavaScript" defer>
<!--
// specific to context menu extensions
var win = external.menuArguments;
// the document object the user right-clicked on
var doc = win.document;
var sXsl;
var sTitle;
// make sure our debugging window is a unique window
var wincounter = 0;

var mywin = window.open("about:blank", "source" + wincounter++, "toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
while (mywin == null)
{
mywin = window.open("about:blank", "source" + wincounter++, "toolbar=no,location=no,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
} // if (mywin == null)


var myDoc = mywin.document;

myDoc.open("text/plain");
if (doc.XSLDocument)
{
 sXsl = doc.XSLDocument.xml;
 sTitle = "XSL for: " + win.location.href;
}
else
{
 sXsl = "No stylesheet found for document.";
 sTitle = "No XSL for: " + win.location.href;
}
myDoc.write(sXsl);
myDoc.close();
myDoc.title = sTitle;


// --> </script> </body> </html>

--

Joe

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords