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 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
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
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
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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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" />
...
|
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...
|
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...
|
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...
|
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")...
|
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...
|
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>...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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,...
|
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: 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...
|
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,...
|
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...
| | |