You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jon Smirl <jo...@mediaone.net> on 2000/06/22 18:07:09 UTC

Xalan-C: stylesheet param bug with match pattern as param?

I'm using a compiled stylesheet.

I did this:
XalanDOMString   host = "unknown";
 pProcessor->setStylesheetParam("host", host);

I unintentionally set the parameter to a match pattern instead of a string.
(XT automatically converted this to a string). This variable is also not
declared in the stylesheet since this particular stylesheet didn't need it.
I end up with a GPF in ElemVariable::getValue().

It's not clear to me that it is legal to set a match pattern as an input
variable. But I'm not sure on this point.

I'm also not sure what is going on here, in
Stylesheet::pushTopLevelVariables(); This looks like it is trying to
evaluate my undeclared variable.

   if (isParam == false)
   {
    XalanDocument* const doc = executionContext.getRootDocument();

    var->execute(executionContext,
        doc,
        doc,
        QName());
   }

I thought it is legal to set undeclared variables but these undeclared
variables would just be ignored.

Jon Smirl
jonsmirl@mediaone.net



Re: Xalan-C: stylesheet param bug with match pattern as param?

Posted by Jon Smirl <jo...@mediaone.net>.
Here's the answer, when compiling the XSLT sheet you need two helper
objects,  XObjectFactoryDefault and XPathFactoryDefault. Don't delete these
objects after the compile, because later when you run the compiled sheet it
needs variables from these objects.

Jon Smirl
jonsmirl@mediaone.net



Re: Xalan-C: stylesheet param bug with match pattern as param?

Posted by Jon Smirl <jo...@mediaone.net>.
I've debugged this some more and the trap is coming from this declaration,
not from setting the variable as I had previously thought.

  <xsl:variable name="menu" select="document('')/xsl:stylesheet/px7:app"/>

I'll keep digging into it.

Open Source is so much better than dealing with Microsoft. I would have
filed a bug with them on this and I would have been lucky to get it resolved
in under two months.

Jon Smirl
jonsmirl@mediaone.net



Re: Xalan-C: stylesheet param bug with match pattern as param?

Posted by Juergen Hermann <jh...@webde-ag.de>.
On Thu, 22 Jun 2000 12:07:09 -0400, Jon Smirl wrote:

>XalanDOMString   host = "unknown";
>pProcessor->setStylesheetParam("host", host);

Apart from this not being the bug you hunted, this form of 
setStylesheetParam() sets an XPath *expression*, so it has to be 

XalanDOMString host = "'unknown'";

when you want "host" to contain the _string_ "unknown".


Ciao, Jürgen

--
Jürgen Hermann (jhe@webde-ag.de)
WEB.DE AG, Amalienbadstr.41, D-76227 Karlsruhe
Tel.: 0721/94329-0, Fax: 0721/94329-22