Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML transform via XLS

Reply
Thread Tools

XML transform via XLS

 
 
Richard Koch
Guest
Posts: n/a
 
      02-01-2004
Hi folks!

I want to transform a XML document using a XLS stylesheet
(transformNodeToObject()). I did my code as the MSDN examples suggest, the
transformation succeeds S_OK. Unfortunately, the XML result doc is not
valid, e.g. get_xml() fails, the string is empty.
Does that sound familiar to anyone? If yes, thanks for your help!

Richard


 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      02-01-2004

"Richard Koch" <> wrote in message
news:401d2988$0$20840$ y.telekom.at...
> Hi folks!
>
> I want to transform a XML document using a XLS stylesheet
> (transformNodeToObject()). I did my code as the MSDN examples suggest, the
> transformation succeeds S_OK. Unfortunately, the XML result doc is not
> valid, e.g. get_xml() fails, the string is empty.
> Does that sound familiar to anyone? If yes, thanks for your help!


You may pass any stream object to contain the result -- e.g. the Response
object (in ASP) or ADODB.Stream


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


 
Reply With Quote
 
 
 
 
Richard Koch
Guest
Posts: n/a
 
      02-01-2004
Sorry, but I do not know what you mean...

"Dimitre Novatchev" <> wrote in message
news:bvjb12$sggmv$...
>
> "Richard Koch" <> wrote in message
> news:401d2988$0$20840$ y.telekom.at...
> > Hi folks!
> >
> > I want to transform a XML document using a XLS stylesheet
> > (transformNodeToObject()). I did my code as the MSDN examples suggest,

the
> > transformation succeeds S_OK. Unfortunately, the XML result doc is not
> > valid, e.g. get_xml() fails, the string is empty.
> > Does that sound familiar to anyone? If yes, thanks for your help!

>
> You may pass any stream object to contain the result -- e.g. the Response
> object (in ASP) or ADODB.Stream
>
>
> Cheers,
>
> Dimitre Novatchev [XML MVP],
> FXSL developer, XML Insider,
>
> http://fxsl.sourceforge.net/ -- the home of FXSL
> Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
>
>



 
Reply With Quote
 
Dimitre Novatchev
Guest
Posts: n/a
 
      02-01-2004

"Richard Koch" <> wrote in message
news:401d3c9d$0$33832$ y.telekom.at...
> Sorry, but I do not know what you mean...
>


Read your MSXML4 SDK Documentation. Here's how the second argument to the
method is described:

"outputObject
An object. On return, contains the product of the transformation of this XML
document based on the XSLT style sheet. If the variant represents the
DOMDocument object, the document is built according to its properties and
its child nodes are replaced during this transformation process. The XML
transformation can also be sent to a stream. "

mk:@MSITStore:C:\Program%20Files\MSXML%204.0\doc\x mlsdk.chm::/htm/xml_mth_sz
_2jp0.htm


Note the last sentence. This is what you need. If the result tree does not
represent a well-formed xml document (e.g. has more than one top element),
the outputObject cannot be a XMLDOMDocument object. But it still can be any
stream object (one that supports the IStream interface) and the stream
object will process (e.g. write to a file) it.

This is a FAQ -- see for example:

http://sources.redhat.com/ml/xsl-lis.../msg01310.html


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html



 
Reply With Quote
 
Julian Reschke
Guest
Posts: n/a
 
      02-02-2004
Richard Koch wrote:

> Hi folks!
>
> I want to transform a XML document using a XLS stylesheet
> (transformNodeToObject()). I did my code as the MSDN examples suggest, the
> transformation succeeds S_OK. Unfortunately, the XML result doc is not
> valid, e.g. get_xml() fails, the string is empty.
> Does that sound familiar to anyone? If yes, thanks for your help!


The output of an XSLT is not necesarily wellformed XML, for instance
when you're using the "text" or "html" output method. Note that XSLT
defaults to the "html" output method when the document element produced
is "html" (either lowercase or uppercase).

So if you need XML, specify "xslutput method='xml'".

Julian
 
Reply With Quote
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      02-02-2004
In article <bvl5sv$t6nsa$>,
Julian Reschke <> wrote:

% So if you need XML, specify "xslutput method='xml'".

Keeping in mind that this doesn't guarantee that your XSL will
generate well-formed XML. For that, you need to define the transformation
correctly.


--

Patrick TJ McPhee
East York Canada

 
Reply With Quote
 
Dimitre Novatchev
Guest
Posts: n/a
 
      02-02-2004

"Patrick TJ McPhee" <> wrote in message
news:bvlvl7$f5q$...
> In article <bvl5sv$t6nsa$>,
> Julian Reschke <> wrote:
>
> % So if you need XML, specify "xslutput method='xml'".
>
> Keeping in mind that this doesn't guarantee that your XSL will
> generate well-formed XML. For that, you need to define the transformation
> correctly.


Yes, the example I gave -- more than one top element, or no top element at
all (just one text node -- such results can be produced using "xslutput
method='xml'".


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending xls file from Server to Client via asp.net Lars Netzel ASP .Net 1 11-10-2005 03:07 PM
problem: Stream XLS to user via ASP page CJM ASP General 2 10-14-2005 02:14 PM
Upload .xls file to SQL Server via ASP.NET app bubberz ASP .Net 1 08-06-2005 12:32 AM
blocking I/O with javax.xml.parsers.DocumentBuilder.parse() and javax.xml.transform.Transformer.transform() jazzdman@gmail.com Java 1 03-27-2005 06:56 AM
What parses the xml/xsl transform in asp.net? System.xml NOT msxml? KathyB ASP .Net 0 06-25-2003 05:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57