Thank you for the response.  I apologize for posting in the incorrect list.

I am using the C++ processor, not Java. And yes, I meant XSLTInputSource - it was the end of a very long day!

I was just using std::stringstream as a first attempt to get it working. I will implement something more efficient once I figure out the rest of the problems (I was thinking of deriving a class from istream, unless you have any better suggestions).

I'm having a small problem with the EntityResolver class. I have created a custom EntityResolver, and called the setEntityResolver function on the XalanTransformer. Then I create an XSLTInputSource object with a std::stringstream containing the first xslt document (again, just until I implement a custom stream that directly interfaces with our stream classes). Then I call compileStylesheet on the XalanTransformer, which causes my EntityResolver to be called. However, the systemId that is passed in has the current working directory prepended to it (the publicId is NULL).

Is this the correct behavior? It seems like it should be the job of my EntityResolver to do any resolving if necessary. Am I just using it incorrectly?

Thanks again for all your help!

Kelly


David Bertoni wrote:
Kelly Graus wrote:
I am working on a code framework that has a fairly robust set of stream classes that allow us to access data from several different sources (ie, files, network files, zip files, executable resources, databases, etc) using a simple path based syntax. I am currently adding Xalan based transformations to the framework, and would like the ability to be able to load the xsl files using our stream classes instead of the classes that Xalan provides. So far, I am able to do this by using our stream classes to read a single xsl file into memory, then using a std::stringstream to create a XalanInputSource. However, several of our transforms reference other transforms.

I'm assuming you're talking about the C++ processor, and not the Java processor. Also, I'm assuming you meant "XSLTInputSource," rather than "XalanInputSource."

I don't know why you are reading the whole stylesheet string into memory, then using std::stringstream to wrap the memory buffer. If you look carefully at the constructors for XSLTInput source, and look at the sample applications, you'll find ways you can adapt your stream classes to Xalan-C's.

For example, I might have a zip file that contains someFile.xml, transform1.xsl, and transform2.xsl. The transform1.xsl file contains a <xsl:include href="transform2.xsl"/> tag. Our stream classes allow us to read directly from the zip file, so I can read transform1.xsl into memory and use it to transform someFile.xml. Obviously, Xalan doesn't know how to read transform2.xsl from the zip file, so this won't work. Is there a way to plug in a class I write that Xalan can use to resolve relative URIs?

You can implement and install an EntityResolver so that Xerces-C will use your stream class. Take a look at the Xerces-C documentation to see what the EntityResolver class looks like.

This sort of question is more appropriate for the user list, rather than the developer list. Please subscribe and post future questions related to using the processor to that list.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to