Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Text output with MSXML? [Thread Next] Re: Text output with MSXML?To: NULL Date: 7/1/2004 2:25:00 PM "Andreas Baus" <anba@c...> wrote in message
news:cc10i7$l1q$1@l......
> I have a problem with creating text output from XSL transformations.
> Basically, when I use code like
>
> oXMLDoc.transformNodeToObject(oXSLDoc, oXMLDoc);
> oXMLDoc.save(strOutputFileName);
>
> the resulting file is always empty, if the XSL has
> <xsl:output method="text"> (things are fine for xml and html output
> methods).
>
> If I use the transformNode method instead to write the result to a string,
> then write the string to a file, it works for text output, but causes a
lot
> of problem with character encoding. Is there a better way to handle XSL
> transformations that can deal with all output methods without requiring
> special case treatment?
>
> --
> ----
> ----------------------------------------------------------------------
-
> [Insert joke
----
>
--
> anba@s... (Andreas Baus)
If you want to use transformNodeToObject and the output is not xml then
receiving object must implement IStream interface, e.g. the Response object
in an ASP page or adodb.stream -
//Test script
function getDomDoc()
{
var oDom = new ActiveXObject("Msxml2.DomDocument.4.0");
oDom.async = false;
return oDom
}
function main()
{
var oStream = new ActiveXObject("Adodb.Stream");
oStream.type = 1; //Binary
oStream.open();
var oSource = getDomDoc();
oSource.load(<xml path here>);
var oStyle = oSource.cloneNode(false);
oStyle.load(<xsl path here>);
oSource.transformNodeToObject(oStyle, oStream);
oStream.saveToFile("results.txt")
oStream.close();
oStyle = null;
oSource = null;
WScript.echo("Done.");
}
main();
--
Joe (MVP - xml)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
