Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > xslt, multiple transforms

Reply
Thread Tools

xslt, multiple transforms

 
 
Random
Guest
Posts: n/a
 
      02-28-2005
Can anyone provide a good example of the simplest way to do multiple
transformations on an xml file? I start out with an xml string and three
physical xslt files, and want to transform the xml using all three
stylesheets, one at a time, and end up with a result xml string.

All the examples I can find have the xml being written to a physical file
every time, and this is not what I want. I can use an in-memory xmlwriter
or xmldocument if that will simplify things.


 
Reply With Quote
 
 
 
 
Wilco Bauwer
Guest
Posts: n/a
 
      02-28-2005
First of all create an XslTransform instance. Then load the XSLT
document (Load()). After that you can apply a transformation to for
example an XmlDocument, by calling Transform(yourDocument,
myXsltArgumentList, output). Some of the allowed outputs are a
textwriter and a stream. This allows you to both write to a
MemoryStream or for example a StringWriter. After you applied a
transformation, you can use both the stream or the string as an input
for your new xml document (XmlDocument.Load and XmlDocument.LoadXml are
relevant).

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl

 
Reply With Quote
 
 
 
 
Random
Guest
Posts: n/a
 
      02-28-2005
This is what I'm trying. I'm still relatively unfamiliar with the Stream
objects, so I'm probably just not understanding how to properly extract the
xml text out to re-use in my next transformation. What method(s) could I
use here?

"Wilco Bauwer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> First of all create an XslTransform instance. Then load the XSLT
> document (Load()). After that you can apply a transformation to for
> example an XmlDocument, by calling Transform(yourDocument,
> myXsltArgumentList, output). Some of the allowed outputs are a
> textwriter and a stream. This allows you to both write to a
> MemoryStream or for example a StringWriter. After you applied a
> transformation, you can use both the stream or the string as an input
> for your new xml document (XmlDocument.Load and XmlDocument.LoadXml are
> relevant).
>
> ----
> - Wilco Bauwer
> Blog & Custom Controls @ http://wilcoding.xs4all.nl
>



 
Reply With Quote
 
Wilco Bauwer
Guest
Posts: n/a
 
      02-28-2005
Once you got the result in a memory stream, you can load it in a new
XML document. You can use that new document for your next
transformation. You can do this as many times as you want.

It should look something like:
MemoryStream outputStream = new MemoryStream();
myTransformer.Transform(inputDoc, args, outputStream);

XmlDocument outputDoc = new XmlDocument();
outputDoc.Load(outputStream);

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple XSL transforms in one? OR a generate-id() problem. Wizfrog XML 1 07-22-2007 11:19 AM
Multiple geometric transforms vs interpolation Paul Rubin Digital Photography 7 02-10-2006 02:37 AM
Multiple XSLT Transforms using a Controller XSLT sneill@mxlogic.com XML 2 10-19-2005 11:00 AM
Multiple XSLt Transforms? rush XML 3 03-30-2005 09:39 PM
Help with transforms Ian Stanley Java 3 07-31-2003 02:59 PM



Advertisments