Subject: Create XML Doc with Stylesheet Declaration
Posted By: rodmcleay Post Date: 11/15/2004 2:47:29 AM
Hi All,

I am using the XMLTextwriter class to create an XML document and this works fine.

However I wish to declare the XLST document in the XML Document and seem to have some trouble with this.

I am getting the an error when writing the XML stylesheet reference.

The error can be seen at:
http://www.centurion.net.au/images/XMLStyleSheetError.gif

If I add the stylessheet declaration to the XML file manuall it displays fine. I just can't add it in code.

Can anyone point out my error.

I have seen examples of how to transform a XML file with the XMLTransform class but I want to save this as an XML Document, not a transformed html document.

Any advise would be appreciated



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply By: rodmcleay Reply Date: 11/15/2004 3:11:11 AM
Found my solution:

            FileInfo stylesheet = new FileInfo("RemittanceTransform.xslt");
            writer.WriteProcessingInstruction("xml-stylesheet",String.Format("type=\"text/xsl\" href=\"{0}\"", stylesheet.FullName));


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================

Go to topic 21965

Return to index page 716
Return to index page 715
Return to index page 714
Return to index page 713
Return to index page 712
Return to index page 711
Return to index page 710
Return to index page 709
Return to index page 708
Return to index page 707