473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

XSLT in VB.Net

Ram

I am new to XSLT. AS I was browsing msdn.com for XSLT I found a an example for this. So, I tried to transform XML is DOM in VB.Net. But I am getting the following errors. Please help me.

ERROR
--------
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication3.exe

Additional information: The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.
VB.NET CODE
---------------

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xsl, out, str
Dim doc As New MSXML2.DOMDocument30()
doc.async = False
doc.validateOnParse = False
doc.resolveExternals = False
doc.load("http://localhost/gxc.xml")

xsl = doc
xsl.Load("http://localhost/test.xsl")

str = doc.transformNode(xsl)
'DOC.transformNode
MsgBox("doc.transformNode: " + doc.xml)

out = doc
doc.transformNodeToObject(xsl, out)
MsgBox("doc.transformNodeToObject:" + vbNewLine + out.xml)

End Sub
test.xsl
--------

<!-- <?xml version="1.0"?> -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<!-- Map "root" element to "network" element. -->

<xsl:template match="GXML">
<xsl:element name="EMPLOYEES">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<!-- Keep any other elements as-is. -->

<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

gxc.xml
--------

<?xml version="1.0" encoding="utf-8" ?>
<GXML>
<CONTACTS>

<CONTACTID ID="C001">
<NAME>Ram</NAME>
<AGE>29</AGE>
<EMAIL>vr**@sap1.com</EMAIL>
<PHONE>1-800</PHONE>
</CONTACTID>

<CONTACTID ID="C002">
<NAME>Dav</NAME>
<AGE>22</AGE>
<EMAIL>da*@sap1.com</EMAIL>
<PHONE>1-800</PHONE>

</CONTACTID>

</CONTACTS>

<EMPLOYEES>

<EMPID ID="E001">
<NAME>Shiva</NAME>
<AGE>29</AGE>
<EMAIL>com</EMAIL>
<PHONE>1-800</PHONE>
</EMPID>

<EMPId ID="E002">
<NAME>Peter</NAME>
<AGE>27</AGE>
<EMAIL>pe***@sap1.com</EMAIL>
<PHONE>1-800</PHONE>
</EMPId>

</EMPLOYEES>
<CLIENTS></CLIENTS>

</GXML>

Nov 12 '05 #1
0 3861

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

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
0
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
3
by: Teksure | last post by:
Hi group, searching in the Internet I found two products for XML which incorporate a very robust debugger for XSL/XSLT, I would like you to see these products and then, give me your opinion about...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

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.