?
Solved

How do I add an XSL record to my XML File?

Posted on 2006-06-22
3
Medium Priority
?
143 Views
Last Modified: 2010-04-30
I need to add a record to my XML file that links the XML file to the XSL file i created.. I have the load and save part, but couldnt find anything on how to add an XSL definition to the exsisting XML file.

Thanks!

        Dim xDoc As XmlDocument

        xDoc = New XmlDocument
        xDoc.Load("C:\Documents and Settings\jwinn\My Documents\XML\QBResponse4.xml")


        xDoc.Save("C:\tesing\myData.xml")
0
Comment
Question by:JasonWinn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16962099
Not quite sure what you mean. Do you want to programmatically add:

    <?xml-stylesheet type="text/xsl" href="yourStylesheet.xsl"?>

?
0
 
LVL 3

Author Comment

by:JasonWinn
ID: 16962102
yep :)
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 16962183
Something like the following shoud do the trick:

        Dim doc As New XmlDocument()
        doc.LoadXml("<root><child>Wibble</child></root>")

        doc.InsertBefore(doc.CreateProcessingInstruction("xml-stylesheet", "type=""text/xsl"" href=""mytransform.xsl"""), doc.DocumentElement)

        MessageBox.Show(doc.OuterXml)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses

752 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