Im trying to code an app in VS.NET that will emulate the command line transform.exe to produce multiple output documents. Ive gone through the win app examples but they only illustrate how to output to a single document rather than multiple documents.
You've got a good point there - I haven't tried it until now. I will add it to my TODO list, but for the moment I'm kind of busy so that will be at least until next week. What type of .NET application are you working on?
I have CC'ed this reply to our lead developer M. David, he may be able to help you more quickly but you'll have to sort that out with him yourself, as I'll be "out of reach" for a couple of days.
I tried an alternative, Oleg Tkachenko's MultiXMLTextWriter class but unfortunately the only snag was that disable-output-escaping is ignored (Ive embedded CDATA blocks in the source XML document that when transformed should appear as HTML tags). So, Ive had to but this on the shelf for the time being though I would be very interested if you get the Saxon.NET winapp written to produce multiple output. I bet its only a few lines, very frustrating - but hey that's life in general.
I'll add this to my list - multiple outputs shouldn't be that much difficult, but I'll check it out later this week, and get back to this thread with the results.
That'd be great , we could then automate a html generation process rather than doing by the command line.
M. David Peterson
This is an XSLT 2.0 specification feature and can be implemented using the <xsl:result-document .../> element. Have you tried using this element and have found problems or are you simply unaware of how to go about this problem in XSLT?
Let me know and I can help you further.
I admit I am kind of new to XSLT. However, I got the SaxonNET Transform.exe working on the command line but had to use the options -o flag to specify a base URI (I used "-o *//" which I suspect is a bit of a cheat). So, when I was looking to implement Transform.exe within a .net app I was stuck as to which method to call to raise the options flag or is it just the case that I only have to call the Transform method with the two arguments? Also, I replaced all the saxon:output with xsl:result-document.
Thanks for the help so far.
Is it the case that, following the C# winapp example, I replace any java.xml.transform objects and methods with the corresponding net.sf.saxon oobjects and methods? Ultimately, do I then create a net.sf.saxon.Transform object then call the DoTransform() method, passing the command line arguments to the string parameter? And finally, do I then need to create an output stream and send it to multiple output?
This is off the top of my head so sorry if it seems garbage.
could you please send me the xml and xsl source documents you used from the command line? You can use email@example.com.
I'll do that asap.
Has any progress been made on this, I have a similiar problem? either way great work guys!
M. David Peterson
HUGE amounts of progress has been made with this. You can access the project blog < http://weblog.saxondotnet.org > and gain access to both the latest bits as well as the source via anonymous Subversion as well as a Trac interface into the repository.
Let me know if and how I can help :)
Thank's muchly, I'll check it out.
ok, I give in.
I'm using Saxon.net for all single document transformations. However I still have to run my multiple-output transformations through Stylus.
This has been a thorn in my side for some time now, and an exhaustive amount of research has turned up nothing.
Does anyone know of some sample code out there?
Should I be using <xsl:result-document, or is Saxon.net expecting something else?
The examples on http://weblog.saxondotnet.org return a string as a result.. Should I be reiterating through an array of resulting strings from the transformation?
I've spent a bit of time going through the Trac repository and haven't beeen able to find anything related to multiple file output, could somebody possible direct me to the responsible files?
Thanks in advance for any help.
Unfortunately, probably because of lack of time and skills, i trawled the web for answers but with no real luck. My thought was that command line Saxon is mirrored by the functionality in Saxon.net
(that is if all functionality has been implemented) so in a method call you would pass the parameter value that gives you the multiple output. But then like you said how do you treat the stream output returned... Basically, if I had an example of multiple output I could look at, brillant.
It's nice to hear I'm not the only one having this problem, I was starting to wonder!! I'm sure there are probably others out there, so if you (or I) do end up finding anything, how about we post it back here.
M. David Peterson
Sorry for the delayed response. I am working under extremely limited time constraints due to a combination of projects all going at the same time.
xsl:result-document works just fine from both the commandline and from with a .NET-enabled language such as C# or VB.NET, etc.. The usage is exactly as it is in the Java Saxon. However, this is a common question that is spurred by the fact that the syntax is different than most people expect.
I do find it strange that you are able to get the same code file to work from Saxon but not Saxon.NET.
I'll tell you what... I am literally in the middle of the 8.5 build of Saxon.NET which, if all goes well, will be available for download in the next little while. As soon as I am done with that I will take a moment and post some sample code using xsl:result-document that I have verified works the same in both Saxon and Saxon.NET.
In the mean time, if you could send me a code sample such that I can take a look at what may be causing the problem that would be great. If you subscribe to the Saxondotnet-Help list and then send it there hopefully we can start creating some content for people to begin referencing in the archives.
Keep an eye on one of the weblog feeds at http://weblog.saxondotnet.org for a RC of Saxon.NET 8.5 release hopefully in the next little while.