XML transform via XLS

Discussion in 'XML' started by Richard Koch, Feb 1, 2004.

  1. Richard Koch

    Richard Koch Guest

    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
    Richard Koch, Feb 1, 2004
    #1
    1. Advertising

  2. "Richard Koch" <> wrote in message
    news:401d2988$0$20840$...
    > 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
    Dimitre Novatchev, Feb 1, 2004
    #2
    1. Advertising

  3. Richard Koch

    Richard Koch Guest

    Sorry, but I do not know what you mean...

    "Dimitre Novatchev" <> wrote in message
    news:bvjb12$sggmv$-berlin.de...
    >
    > "Richard Koch" <> wrote in message
    > news:401d2988$0$20840$...
    > > 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
    >
    >
    Richard Koch, Feb 1, 2004
    #3
  4. "Richard Koch" <> wrote in message
    news:401d3c9d$0$33832$...
    > 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:mad:MSITStore:C:\Program%20Files\MSXML%204.0\doc\xmlsdk.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-list/2002-07/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
    Dimitre Novatchev, Feb 1, 2004
    #4
  5. 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 "xsl:eek:utput method='xml'".

    Julian
    Julian Reschke, Feb 2, 2004
    #5
  6. In article <bvl5sv$t6nsa$-berlin.de>,
    Julian Reschke <> wrote:

    % So if you need XML, specify "xsl:eek:utput 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
    Patrick TJ McPhee, Feb 2, 2004
    #6
  7. "Patrick TJ McPhee" <> wrote in message
    news:bvlvl7$f5q$...
    > In article <bvl5sv$t6nsa$-berlin.de>,
    > Julian Reschke <> wrote:
    >
    > % So if you need XML, specify "xsl:eek:utput 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 "xsl:eek:utput
    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
    Dimitre Novatchev, Feb 2, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KathyB
    Replies:
    0
    Views:
    1,004
    KathyB
    Jun 25, 2003
  2. bubberz
    Replies:
    1
    Views:
    522
    Steve C. Orr [MVP, MCSD]
    Aug 6, 2005
  3. Lars Netzel
    Replies:
    1
    Views:
    1,097
    S. Justin Gengo
    Nov 10, 2005
  4. Replies:
    1
    Views:
    729
    Esmond Pitt
    Mar 27, 2005
  5. CJM
    Replies:
    2
    Views:
    114
Loading...

Share This Page