473,560 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XslCompiledTran sform not outputting to XmlDocument

Hi guys/gals,

Can you help with this? I am trying to use an XSL tranform with the new
XslCompiledTran form class. I want it to output to a XmlDocument, but
the document is empty after .Transform(...) but i Know thethe xsl and
source xml are fine becasue if I output the Transform to a file it
works fine. Here's what i'm doing:

// Output doc
XmlDocument xmlReg = new XmlDocument();

//Sort with Xslt
XslCompiledTran sform xsl = new XslCompiledTran sform();
xsl.Load("DocSo rtByDate.xsl");
xsl.Transform(" DocList.xml",
null,xmlReg.Cre ateNavigator(). AppendChild());
Any suggestions??

Many thanks,


May 15 '06 #1
3 7175

p-*********@iname .com wrote:

Can you help with this? I am trying to use an XSL tranform with the new
XslCompiledTran form class. I want it to output to a XmlDocument

You could Transform to a MemoryStream and reset its position to 0 after
the transformation and then load then stream into an XmlDocument instance.

Or check the MVP XML project and the XslReader which allows you to
consume the result of an XSLT transformation as an XmlReader and load
that into the XmlDocument instance:
<http://mvp-xml.sourceforge .net/api/2.0/T_Mvp_Xml_Commo n_Xsl_XslReader .html>

Martin Honnen --- MVP XML
May 15 '06 #2
p-*********@iname .com wrote:
Can you help with this? I am trying to use an XSL tranform with the new
XslCompiledTran form class. I want it to output to a XmlDocument, but
the document is empty after .Transform(...) but i Know thethe xsl and
source xml are fine becasue if I output the Transform to a file it
works fine. Here's what i'm doing:

The problem with this code is that XmlWriter created by
xmlReg.CreateNa vigator().Appen dChild() won't get closed. Use different

XmlDocument doc = new XmlDocument();
using (XmlWriter writer = doc.CreateNavig ator().AppendCh ild()) {
xslt.Transform( input, (XsltArgumentLi st)null, writer);

Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
May 16 '06 #3
Many thanks, that worked perfectly!


May 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now using XslCompiledTransform, the Transform method hangs. My code: Function TransformXML(ByRef FacXML As Xml.XmlDocument, ByVal XslFile As String) As...
by: mrc | last post by:
How do I do the following using streams instead of actual files. I've tried it using memory streams for the input/and output but I don't seem to be able to get the output stream to contain anything. Friend Shared Function ApplyTransform(ByVal strXSLTransform As String, ByVal objReport As Xml.XmlDocument) As XmlDocument Dim settings As...
by: S. David Kyle | last post by:
I am having a weird issue when I generate an input Html tag from a Xsl transformation. When the trasform is executed on the xsl below, the <inputtag has the closing slash removed in the first case and the closing tag removed in the second case. As a side note, if I change <inputto <input1>, the closing tag does not get removed.
by: Steve | last post by:
I am using XslCompiledTransform to transform XML into Excel 2003 SpreadsheetML. In order to get the resulting XML file to open in Excel, we need the following two lines at the top of the file: <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> I can get the <?mso-application ...line by using an...
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b) ..... // xsl contents abc.aspx?p1=v1&amp;p2=<xsl:value-of select="$v2" />
by: Simon Harvey | last post by:
Hi all, I'm having a real problem with getting an XMLWriter as a result of an xsl tranform I'm attempting. My code is: private void btnPerformTransform_Click(object sender, EventArgs e) { // Load the style sheet. XslCompiledTransform xslt = new XslCompiledTransform();
by: Mark | last post by:
I'm getting the error "The URI scheme is too long." in the code below. What is URI in this context? The XSL or the XML being transformed? Thanks! -Mark StringBuilder sb = new StringBuilder(); //Create the XslCompiledTransform and Load it with the xsltDocument XslCompiledTransform xslCompiledTransform = new XslCompiledTransform();
by: Andy Fish | last post by:
Hi, From reading the documentation, I get the impression that XslCompiledTransform should be faster than XslTransform on my test with a large complex document and a large complex XSLT, the transform took 4 minutes with XslTransform but 7 minutes with XslCompiledTransform. However, with the same stylesheet on another large complex...
by: =?Utf-8?B?Vmlub2Q=?= | last post by:
Hi, I am having a problem doing the transform. Actually i am migrating the code from XslTranform class into XslCompiledTransform class. Here is the code that i am using in .net 1.1 private void DoTransform(ref XslTransform arrTransformations, ref XmlDocument objSource,
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.