?
Solved

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

Posted on 2006-06-22
3
Medium Priority
?
146 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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

862 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