Re: [xslt] Why is an invalid stylesheet parameter value not an error?



Hi,

any comments on this one? It's based on a bug reported for lxml that I would
like to fix.

https://bugs.launchpad.net/lxml/+bug/208339

This can be reproduced with xsltproc, BTW, using this XML file:

-------------------
<test/>
-------------------

and this XSLT file:

-------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">
    <xsl:template match="/">
        <a><xsl:value-of select="$value"/></a>
    </xsl:template>
</xsl:stylesheet>
-------------------

with this command:

    # xsltproc --param value "ival" test.xslt test.xml

The output is:

-------------------
<?xml version="1.0"?>
<a/>
-------------------

It would really be helpful to get some kind of an error here, instead of
silently returning an unexpected result.

Thanks,
Stefan


Stefan Behnel wrote:
> in variables.c, function xsltProcessUserParamInternal(), it says:
> 
>         if (result == NULL) {
>             xsltTransformError(ctxt, style, NULL,
>                 "Evaluating user parameter %s failed\n", name);
>             ctxt->state = XSLT_STATE_STOPPED;
>             return(-1);
>         }
> 
> So an invalid value for a stylesheet parameter will stop processing but will
> not signal an error in "state", which is explicitly reset from ERROR to
> STOPPED here. Is that correct?
> 
> At a quick glance, I didn't find anything in the spec about this, but I would
> actually like to see this signaled to the application level (other than a
> plain string message).
> 
> Is there an easy way to find out that this case has occurred?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]