• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

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

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.


        Dim xDoc As XmlDocument

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

  • 2
1 Solution
Carl TawnSystems and Integration DeveloperCommented:
Not quite sure what you mean. Do you want to programmatically add:

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

JasonWinnAuthor Commented:
yep :)
Carl TawnSystems and Integration DeveloperCommented:
Something like the following shoud do the trick:

        Dim doc As New XmlDocument()

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now