You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by charlie <cf...@thesaberfund.com> on 2000/06/14 11:26:35 UTC

Problem with embedded Stylesheets

Generally I embed a stylesheet processing instruction into an XML file
and thus do not use the -XSL command line parameter (or equivalent) in
Xalan.

This used to work well because you could pass NULL for the
stylesheetSource to the method XSLTEngineImpl::process method.
Unfortunately, this is no longer the case since the code requires this
parameter to be set.  Fair enough.

However, what happens now happens is that XSLTEngineImpl::process will
call XSLTEngineImpl::processStylesheet.  This will then either check to
see if the stylesheet is a system ID or  a DOM node.  If it is neither,
Xalan will raise an exception, which is caught in
XSLTEngineImpl.process.

To avoid having this exception raised I tried to specify a null string
in the stylsheetSource parameter.   This didn't work - instead you get a
GPF.

So, to use an embedded processing instruction you need to specify an
invalid systemID, then you need to catch the exception.  This seems like
a lot of overhead (of course, maybe I'm missing something obvious).

Instead, I would prefer that the stylesheetSource parameter in
XSLTEngineImpl::process could just be set to null.  Another approach
would be to add the following if statement to
XSLTEngineImpl::processStylesheet:

 StylesheetRoot*  theStylesheet = 0;

  if (0 == stylesheetSource.getSystemId() &&
      0 == stylesheetSource.getNode())
     return theStylesheet;

Thanks,

Charlie Savage