Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2004, 03:47 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default Create XML Doc with Stylesheet Declaration

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/X...SheetError.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.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
 
Old November 15th, 2004, 04:11 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

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.
======================================




Similar Threads
Thread Thread Starter Forum Replies Last Post
xml declaration not displayed zsheema XSLT 10 May 15th, 2008 04:36 AM
xml declaration chroniclemaster1 XML 0 September 20th, 2007 02:00 PM
omit-xml-declaration dextermagnific XSLT 3 August 4th, 2006 09:55 AM
Calling Other xml from stylesheet jlarremore XSLT 1 October 12th, 2005 01:02 PM
2 XML Docs > 1 XSLT Stylesheet kwilliams XSLT 3 September 12th, 2005 11:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.