How to reference XSL style sheet into XML file in VB.NET?

I am trying to declare the “XSL style sheet reference" to XML file that My VB.NET application is creating at run time.

This is the XSL reference which should go to the header of the XML file

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

ds.writexml(filename)

Will produce something like this

="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>
USA</country>
<company>
Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
..
</catalog>

I want to reference the XSL file into the header of the previous file.

Something looks like this

="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
..
</catalog>

[3612 byte] By [CETPRG455] at [2007-12-23]
# 1
Sorry the dataset's writexml does not allow you to specify a stylesheet. You will have to xmlwriter class instead.
KenTucker at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Actually, you can use both. DataSet.WriteXML has an overload that takes in an XmlWriter.

You can create an XmlWriter, output the processng instruction with its WriteProcessingInstruction method, and then pass the XmlWriter into DataSet.WriteXML.

-Scott Wisneiwski
MS VB Compiler Dev

scottwis_MS at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...