You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by ch...@jpmchase.com on 2005/11/04 14:53:27 UTC

Problems with XSLTInputSource

Hi

I am quite new to Xalan and XSLT and Im having a few problems trying to 
transform an XML message using a simple XSLT file.

I have a char* inputMessage that contains the xml to be transformed.  I am 
using an isstrstream to populate the XSLTInputSource.  I am also using the 
compileStylesheet method, which is returning without error.  I get the 
following error when I try the transformation:

Fatal Error.Occurred at unknown file , line 1 , column 2. Expected an 
element name

Ive tried stripping down the input msg to just a couple of tags, but still 
get the same error msg.

Any help or pointers would be much appreciated.

Cheers
Chris



        XALAN_USING_XERCES(XMLPlatformUtils)
        XALAN_USING_XALAN(XalanTransformer)
        XALAN_USING_XALAN(XSLTInputSource)
        XALAN_USING_XALAN(XSLTResultTarget)
        XALAN_USING_XALAN(XalanCompiledStylesheet)



        XMLPlatformUtils::Initialize();
        XalanTransformer::initialize();

         XalanTransformer theXalanTransformer;

         istrstream str(inputMessage, strlen(inputMessage)); 
         XSLTInputSource msgToTransform(&str);

          XSLTResultTarget xmlOut(cout);

 
          const char* pTheXSLFileName = "/vobs/tr/tr/exe/test.xsl";
          const XalanCompiledStylesheet* pCompiledStylesheet = 0;
          theResult = theXalanTransformer.compileStylesheet( 
pTheXSLFileName, 
 pCompiledStylesheet );


           if(theResult == 0)
           {
                 theResult = theXalanTransformer.transform( 
msgToTransform,
 pCompiledStylesheet,
                                                          xmlOut );
 

Re: Problems with XSLTInputSource

Posted by David Bertoni <db...@apache.org>.
christopher.j.downey@jpmchase.com wrote:
> 
> Hi
> 
> I am quite new to Xalan and XSLT and Im having a few problems trying to 
> transform an XML message using a simple XSLT file.
> 
> I have a char* inputMessage that contains the xml to be transformed.  I 
> am using an isstrstream to populate the XSLTInputSource.  I am also 
> using the compileStylesheet method, which is returning without error.  I 
> get the following error when I try the transformation:
> 
> Fatal Error.Occurred at unknown file , line 1 , column 2. Expected an 
> element name
> 
> Ive tried stripping down the input msg to just a couple of tags, but 
> still get the same error msg.
> 
> Any help or pointers would be much appreciated.
>

I would help to know the compiler and platform you're using.  Also, 
please verify that if you create a file that contains the bytes you are 
tyring to parse, you can use an ifstream to read the document.

That error message is from the parser, and it indicates the parser 
thinks the bytes in the stream are not a well-formed XML document.

Dave