473,396 Members | 1,768 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,396 software developers and data experts.

xslt, multiple transforms

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.
Nov 19 '05 #1
3 1120
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

Nov 19 '05 #2
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" <wi****@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr 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

Nov 19 '05 #3
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

Nov 19 '05 #4

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

Similar topics

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...
3
by: rush | last post by:
I have a DTD that defines new elements "mytextfield" and "mysn", and does it as an extension to XHTML. The idea is that my XML markup is actually valid XHTML according to my DTD. This all works...
2
by: sneill | last post by:
Hello all, In the August 2003 edition of "XML Journal" (see: http://xml.sys-con.com/read/40671.htm) Pietro Michelucci wrote an interesting article entitled "Object-Oriented XSLT". The article...
3
by: Jack Fox | last post by:
I've never had the need to work with XML, but I believe I now have an appropriate application. I have time-series data in objects organized as a tree that I want an ASP.NET program to write out to...
2
by: RJN | last post by:
Hi Can XSLT be applied for transforming .txt files or are they applicable only for xml to xml transformation. Currently all the clients send file to a server in one particular format. The...
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...
2
by: Gibson | last post by:
Hi all, i transform xml A to xml B with an xslt. Is it possible to use that xslt to tranform xml B to xml A? Or exist tools to create a corresponding xslt B from the original xslt? Thanks for...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
4
by: sadc1986 | last post by:
How does one introduce multiple worksheets in a excel using Xslt Transforms my code... Please suggest <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
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:
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?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.