473,397 Members | 2,068 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,397 software developers and data experts.

XSLT, coming from ASP model

Hello,

I am moving over from using msxml2.domdocument to system.xml and
system.xml.xsl.

I'd like to present this to my group today, so your help is appreciated.

I want to transform an XML object (built on the fly) with an XSL document
(URL to document) and have it return a string object for my function.

Here's where I am:

Function x as String
'this function will return transformed xml
Dim oXML as New System.xml.xmldocument
oXML.LoadXML("<document/>")

oXSL as New System.xml.xmldocument
oXSL.Load([stylesheet])

x = ???
End Function

I started down the path of creating an XMLReader class, and I was going to
"read" that into x. Am I on the right track?

Your help is appreciated,

Eric
Nov 12 '05 #1
8 2115
Eric Phetteplace wrote:
I am moving over from using msxml2.domdocument to system.xml and
system.xml.xsl.

I'd like to present this to my group today, so your help is appreciated.

I want to transform an XML object (built on the fly) with an XSL document
(URL to document) and have it return a string object for my function.

Here's where I am:

Function x as String
'this function will return transformed xml
Dim oXML as New System.xml.xmldocument
oXML.LoadXML("<document/>")

oXSL as New System.xml.xmldocument
oXSL.Load([stylesheet])

x = ???
End Function


No, that's MSXML model. In .NET you better use the following (C# code):

XmlDocument doc = new XmlDocument();
//Build it
doc.LoadXml("<doc/>");
XslTransform xslt = new XslTransform();
//Load stylesheet (you should use here Server.MapPath in ASP.NET)
xslt.Load("whatever.xsl");
StringWriter sw = new StringWriter();
//Run transformation
xslt.Transform(doc, null, sw, null);
sw.Close();
return sw.ToString()

Additionally consider caching compiled XslTransform object for
repetitive transformations.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Eric Phetteplace wrote:
I am moving over from using msxml2.domdocument to system.xml and
system.xml.xsl.

I'd like to present this to my group today, so your help is appreciated.

I want to transform an XML object (built on the fly) with an XSL document
(URL to document) and have it return a string object for my function.

Here's where I am:

Function x as String
'this function will return transformed xml
Dim oXML as New System.xml.xmldocument
oXML.LoadXML("<document/>")

oXSL as New System.xml.xmldocument
oXSL.Load([stylesheet])

x = ???
End Function


No, that's MSXML model. In .NET you better use the following (C# code):

XmlDocument doc = new XmlDocument();
//Build it
doc.LoadXml("<doc/>");
XslTransform xslt = new XslTransform();
//Load stylesheet (you should use here Server.MapPath in ASP.NET)
xslt.Load("whatever.xsl");
StringWriter sw = new StringWriter();
//Run transformation
xslt.Transform(doc, null, sw, null);
sw.Close();
return sw.ToString()

Additionally consider caching compiled XslTransform object for
repetitive transformations.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3
Thanks Oleg, that's what I needed.

However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method. I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.

Perhaps it doesn't recognize my null? System.DBNull didn't help. Perhaps
it's the XMLDocument?

Eric
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Eric Phetteplace wrote:
I am moving over from using msxml2.domdocument to system.xml and
system.xml.xsl.

I'd like to present this to my group today, so your help is appreciated.

I want to transform an XML object (built on the fly) with an XSL document (URL to document) and have it return a string object for my function.

Here's where I am:

Function x as String
'this function will return transformed xml
Dim oXML as New System.xml.xmldocument
oXML.LoadXML("<document/>")

oXSL as New System.xml.xmldocument
oXSL.Load([stylesheet])

x = ???
End Function


No, that's MSXML model. In .NET you better use the following (C# code):

XmlDocument doc = new XmlDocument();
//Build it
doc.LoadXml("<doc/>");
XslTransform xslt = new XslTransform();
//Load stylesheet (you should use here Server.MapPath in ASP.NET)
xslt.Load("whatever.xsl");
StringWriter sw = new StringWriter();
//Run transformation
xslt.Transform(doc, null, sw, null);
sw.Close();
return sw.ToString()

Additionally consider caching compiled XslTransform object for
repetitive transformations.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #4
Thanks Oleg, that's what I needed.

However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method. I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.

Perhaps it doesn't recognize my null? System.DBNull didn't help. Perhaps
it's the XMLDocument?

Eric
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Eric Phetteplace wrote:
I am moving over from using msxml2.domdocument to system.xml and
system.xml.xsl.

I'd like to present this to my group today, so your help is appreciated.

I want to transform an XML object (built on the fly) with an XSL document (URL to document) and have it return a string object for my function.

Here's where I am:

Function x as String
'this function will return transformed xml
Dim oXML as New System.xml.xmldocument
oXML.LoadXML("<document/>")

oXSL as New System.xml.xmldocument
oXSL.Load([stylesheet])

x = ???
End Function


No, that's MSXML model. In .NET you better use the following (C# code):

XmlDocument doc = new XmlDocument();
//Build it
doc.LoadXml("<doc/>");
XslTransform xslt = new XslTransform();
//Load stylesheet (you should use here Server.MapPath in ASP.NET)
xslt.Load("whatever.xsl");
StringWriter sw = new StringWriter();
//Run transformation
xslt.Transform(doc, null, sw, null);
sw.Close();
return sw.ToString()

Additionally consider caching compiled XslTransform object for
repetitive transformations.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #5
Eric Phetteplace wrote:
However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method.
Hmm. Which .NET version are you using? There is a difference in
XslTransform API between .NET 1.0 and 1.1. I meant the following method:

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable,
XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList,
TextWriter, XmlResolver);

XmlDocument is IXPathNavigable and StringWriter is TextWriter.
I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.


It's Nothing as far as I know. in VB.NET you should have something like

xslt.Transform(doc, Nothing, sw, Nothing)

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #6
Eric Phetteplace wrote:
However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method.
Hmm. Which .NET version are you using? There is a difference in
XslTransform API between .NET 1.0 and 1.1. I meant the following method:

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable,
XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList,
TextWriter, XmlResolver);

XmlDocument is IXPathNavigable and StringWriter is TextWriter.
I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.


It's Nothing as far as I know. in VB.NET you should have something like

xslt.Transform(doc, Nothing, sw, Nothing)

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #7
Using 'Nothing' in place of 'null' solved the problem.

Thanks again Oleg. You've been most helpful.

Regards,

Eric Phetteplace

"Oleg Tkachenko [MVP]" <oleg@no_!spam!_please!tkachenko.com> wrote in
message news:OY**************@TK2MSFTNGP10.phx.gbl...
Eric Phetteplace wrote:
However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method.


Hmm. Which .NET version are you using? There is a difference in
XslTransform API between .NET 1.0 and 1.1. I meant the following method:

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable,
XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList,
TextWriter, XmlResolver);

XmlDocument is IXPathNavigable and StringWriter is TextWriter.
I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.


It's Nothing as far as I know. in VB.NET you should have something like

xslt.Transform(doc, Nothing, sw, Nothing)

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #8
Using 'Nothing' in place of 'null' solved the problem.

Thanks again Oleg. You've been most helpful.

Regards,

Eric Phetteplace

"Oleg Tkachenko [MVP]" <oleg@no_!spam!_please!tkachenko.com> wrote in
message news:OY**************@TK2MSFTNGP10.phx.gbl...
Eric Phetteplace wrote:
However, when I try to compile, (forgive the paraphrasing, as I'm not in
front of my .NET machine) I get an error saying there isn't a Transform
method with these parameter types. There are 18 definitions of the
Transform method.


Hmm. Which .NET version are you using? There is a difference in
XslTransform API between .NET 1.0 and 1.1. I meant the following method:

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable,
XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList,
TextWriter, XmlResolver);

XmlDocument is IXPathNavigable and StringWriter is TextWriter.
I had to use chr(0) in place of the NULL keyword, since
there is no NULL in VB.NET.


It's Nothing as far as I know. in VB.NET you should have something like

xslt.Transform(doc, Nothing, sw, Nothing)

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #9

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

Similar topics

9
by: Christian Roth | last post by:
Hello, when using this "identity" processing sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="iso-8859-1" /> ...
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...
9
by: Jeff Rubard | last post by:
I am curious to know whether anyone has experience using XSLT for web XML (non-XHTML) styling, either with CSS or standalone. I myself have engaged in rather unsuccessful experiments with the...
5
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
6
by: Prashanth Ellina | last post by:
Hi, I am an XSLT newbie. I need to solve something which I will express in pseudo-code. function f1() { xmltree = <emptydom> addnamevaluepair(xmltree, "size","100")...
2
by: seeCoolGuy | last post by:
I'm new to the whole XML / XSL tech, I've used XML w/ ado recordsets before and have had no issues but never needed to transfer files between systems. Now w/ Sql Server I need to import a large...
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>...
0
by: poli | last post by:
Hi, It is my first xslt document that I have to write. And I have to do it quick (1 day). PLease help me. I have this input xml file: <?xml version="1.0" encoding="UTF-8"?> <Node...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.