[Mono-devel-list] Functional XSLT resolved to uri transformation example?

Joshua Tauberer tauberer at for.net
Tue Dec 14 10:20:36 EST 2004

Jason Starin | Giant Head wrote:
> Does anyone have a functional example of code for Mono that loads an 
> xslt, an xml file and then performs the resolved transformation

The basic idea is:

using System.Xml;
using System.Xml.Xsl;
XmlDocument xsl = new XmlDocument();
XslTransform transform = new XslTransform();
TextWriter textwriter = new StreamWriter(new
     FileStream("path/to/output.html", FileMode.Create));
XmlTextWriter writer = new XmlTextWriter(textwriter);
XmlDocument xmlfile = new XmlDocument();
transform.Transform(xmlfile, null, writer, null);
(and close the writers and streams)

> and outputs to a URI

Don't know what you mean.

> and then can save to a directory

Got that above.

> that has mono as an owner and apache as a group owner?

You can run on the command line:

chown -R username.apache htmlpath

to recursively set the ownership of everything in the htmlpath directory.

> I’m trying to generate a lot of 
> static html pages from xml files using a common xslt. 

Monodocs2HTML is a slightly complicated example of a program that does 
that (beware of wrapping):

If you happen to be doing this because you think running XSLT on-line to 
power a website would be too slow, it's actually very fast.  (Shameless 
plug alert.)  See: http://taubz.for.net/code/xpd

Good luck.

- Joshua Tauberer


** Nothing Unreal Exists **

More information about the Mono-devel-list mailing list