Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Text output with MSXML?

From: "Joe Fawcett" <joefawcett@-------.--->
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)





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent