Re: [xslt] Element fake in func:function error: bug or feature?

On Tue, Apr 22, 2008 at 02:19:11PM +0200, Mark Howe wrote:
> Hi,
> If I run
> <xsl:stylesheet version="1.0"
>     xmlns:xsl="";
>     xmlns:baa="foo"
>     xmlns:func="";
>     extension-element-prefixes="baa">
>    <xsl:template match="/">
>      <xsl:copy-of select="baa:frob()"/>
>    </xsl:template>
>    <func:function name="baa:frob">
>      <frob/>
>    </func:function>
> </xsl:stylesheet>
> through xsltproc (using the stylesheet as its own input) I get
>    ELEMENT fake
> element fake: error : Node has no parent
>      ELEMENT frob
> {foo}frob: cannot write to result tree while executing a function
> xmlXPathCompiledEval: evaluation failed
> The second bit is fair enough (there's a missing func:result), but the 
> fake element bit is a bit alarming, and since it produces a tree of the 
> attempted output it can result in absolutely huge log entries (I have 
> examples exceeding 500 lines).
> Also, in our application the backtrace appears on the console (so 
> presumably STDOUT or STDERR), even though we send other LibXSLT errors 
> to a log file.

  Hard coded in libexslt. 
------------------------------- functions.c --------------------------
     * It is an error if the instantiation of the template results in
     * the generation of result nodes.
    if (fake->children != NULL) {
        xmlDebugDumpNode (stderr, fake, 1);
                         "{%s}%s: cannot write to result tree while "
                         "executing a function\n",
                         ctxt->context->functionURI, ctxt->context->function);

> So I guess my questions are
> 1: Are we supposed to get the fake element thing, and, if not, would it 

  yes you are assuming you used the EXSLT extension for functions in
your stylesheet and you managed to break the associated generation of
the template result.

> be possible to turn it off?

  by patching/recompiling

> 2: If we are supposed to get it, is there any way to control which 
> stream it writes to?

  no it's stderr, see the code.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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