none
All data is not displaying after the conversion of xsl and xml programmatically

    Question

  • Hi,

    I am using XslCompiledTransform for generating html file in my VB.Net 3.5 project. when i use the xsl and xml in visual studio and debug it, the output html file displays all the data. But in program, it is not displaying all the data in the newlt generated html.

    here is the code i am using.

    Dim xmlDoc As System.Xml.XmlDocument
            Dim xslTran As System.Xml.Xsl.XslCompiledTransform
            Dim root As XmlElement
            Dim nav As XPath.XPathNavigator
            Dim writer As XmlTextWriter


    xmlDoc = New XmlDocument
                xmlDoc.Load(xmlPath)

                xslTran = New Xsl.XslCompiledTransform(False)
                xslTran.Load(xsltPath)

                root = xmlDoc.DocumentElement

                nav = root.CreateNavigator

                writer = New XmlTextWriter(IO.Path.Combine(outputpathPath, IO.Path.GetFileNameWithoutExtension(xmlPath)) + ".html", System.Text.Encoding.Default)
                writer.Formatting = Formatting.Indented
                writer.Flush()

                xslTran.Transform(nav, writer)

                writer.Close()

    Pls help me.........................

    Thanks in advance...............

    • Edited by Luttapi Tuesday, March 16, 2010 2:29 PM modified
    Tuesday, March 16, 2010 2:25 PM

All replies

  • What do you need the XmlDocument, the XPathNavigator and the XmlTextWriter for? Why don't you simply use
      xslTran.Transform(xmlPath, IO.Path.Combine(outputpathPath, IO.Path.GetFileNameWithoutExtension(xmlPath)) + ".html");



    Other than that is is hard to tell, you will need to show us the details of the input XML and the stylesheet if you want us to understand what is happening exactly that output gets lost and how to avoid that.
    MVP XML My blog
    Tuesday, March 16, 2010 4:19 PM
  • Hi,

    I tried with your solution and the result was same. All datas are not displaying. It is same as before.

    Any idea about it ????

    Thanks for the reply and help.
    Wednesday, March 17, 2010 8:55 AM
  • Well you will have to provide the necessary details such as a minimal XML input document and XSLT stylesheet to allow us to reproduce the problem and then the output you think you should get and the output you get. Otherwise we can't tell what is wrong.
    MVP XML My blog
    Wednesday, March 17, 2010 11:48 AM
  • Hi,

    Pls tell me your mail id.

    Thanks,
    Wednesday, March 17, 2010 12:16 PM
  • This forum allows you to include code samples so use this forum to provide minimal but complete samples that allow us to reproduce the problem.
    MVP XML My blog
    Wednesday, March 17, 2010 12:26 PM