473,373 Members | 1,003 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,373 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 2113
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.