Solved

Using XML/XSL in webBrowser Control

Posted on 2004-09-29
1
196 Views
Last Modified: 2013-12-26
I'm currently retrieving an xml block using a stylesheet from the database and storing it in a variable.  I can write this block to the webBrowser control, but it does not find the stylesheet that I want to utilize for formatting.  I've tried absolutely pathing the stylesheet in the xml block and numerous other path options and none seem to work.  When I save the xml to the drive and open it in the browser object all is fine.  I'm assuming it cannot resolve the position of the stylesheet.  Is there a special trick to this?  Any sort of direction would be helpful!!

Here is the xml block
       <?xml version=''1.0''?>
       <?xml-stylesheet TYPE=''text/xsl'' href=''/xsl/AGENT_OUTBOUND_CALLS.xsl''?>
       <AGENT_OUTBOUND_CALL>
           <CAMPAIGN_NAME></CAMPAIGN_NAME>
           <CAMPAIGN_ID></CAMPAIGN_ID>
           <GROUP_ID></GROUP_ID>
           <GROUP_NAME></GROUP_NAME>
           <CONTACT>My Name</CONTACT>
           <PHONE>345-3456</PHONE>
           <DATE>9/28/2004</DATE>
           <TIME>10:30</TIME>
           <COMMENTS>Need TO call about something</COMMENTS>
           <PRIORITY>1</PRIORITY>
       </AGENT_OUTBOUND_CALL>

Browser call (sXML is the above code retrieved from the DB, i'd prefer not to write it to a file and just dynamically populate the browser):
   frmConsole.wbOutbound.Navigate ("about:" + sXML)
0
Comment
Question by:tgriffit
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 250 total points
Comment Utility
Its probably just easier to apply the transform using the DOM, and simply write the results to the webbrowser.

Something like:

   Dim oXML As New DOMDocument40
   Dim oXSL As New DOMDocument40
   Dim sResult As String

   '// Set up web browser
   webbrowser1.navigate2 "about:blank"

   While webbrowser1.document.readyState <> "complete"
      DoEvents
   Wend

   '// Load XML and XSL
   oXML.loadXML sXML
   oXSL.load app.path & "\xsl\AGENT_OUTBOUND_CALLS.xsl"

   '// Apply transform
   sResult = oXML.transformNode(oXSL)

   '// Write results to browser
   webbrowser1.document.write sResult


You will need to add a reference to the "Microsoft XML 4.0" library in Project > References

Hope this helps.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now