Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 June 24th, 2003, 03:30 PM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dimondwoof
Default XML to XML through an XSLT (VB.NET)

I can't seem to find out how to run an XML object through an XSLT to get a new XML object. I've tried the following code:

  Private Function TransformDocument(ByVal doc As XmlDocument) As XmlDocument
    Try
      Dim xslt As New XslTransform
      xslt.Load("D:\Convert.xslt")
      Dim reader As XmlReader
      reader = xslt.Transform(doc, Nothing)
      TransformDocument.Load(reader)
    Catch ex As Exception
      MessageBox.Show("TransformDocument" & vbCr & ex.Message & vbCr & ex.GetType.ToString)
    End Try
  End Function

But I get the following error message:

TransformDocument
file:///D:/Convert.xslt(2,2) :
System.XML.XSL.XSTLCompileException

Can anyone give me a hint as to how to do this? If my code model is all wrong, I'm happy to change it in any way, I'm not married to the structure. I just want to do all this internally, without writing XML files out to the hard drive.

Thanks
 
Old June 25th, 2003, 12:07 PM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dimondwoof
Default

OK, I found out there were some errors in my XSLT document (not coding errors, but additional info that I copied out of the XSD that shouldn't have been there).

So, the code runs without erroring, BUT it doesn't do anything! I get the same XML document back as the one I give it. Can anyone out there tell me how to apply an XSL template to an XML document? I can't believe how hard this is! You would think it would be one of the simplest things in the .NET world, but I can't find ANYONE who can give me code that works! Even when I write the XML out to a file (which I HATE to do, I've already got it in memory, why should I have to write it out to a file and then re-read it???)

Isn't there ANYONE out there who has applied an XSLT to an XML document in memory???????





Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.net, adding XML data to an existing XML file saikoboarder XML 11 April 17th, 2008 04:19 PM
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 04:26 PM
merge two xml file and make new xml using xslt ketan XSLT 0 September 21st, 2004 08:48 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM





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