Solved

Using XML/XSL in webBrowser Control

Posted on 2004-09-29
1
198 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
ID: 12185063
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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