Should exsltFuncFunctionComp() be compiling it's contents? Currently it calls xsltParseTemplateContent(), but not xsltInitElemPreComp() (or similar function).
The impact is that if you make the mistake of putting content directly in your <func:function>, you get: xsltApplySequenceConstructor: value-of was not compiled and no clue where the bug in your script is. If your script also has text nodes, you get: xsltApplySequenceConstructor: value-of was not compiled ELEMENT fake element fake: error : Node has no parent TEXT content= {http://xml.juniper.net/test}test-func: cannot write to result tree while executing a function xmlXPathCompiledEval: evaluation failed runtime error: file /tmp/te30.xsl line 5 element value-of XPath evaluation returned no result. which is much more helpful. Would compiling the contents of the function help get a better error to the user? Examples appended (with and without text nodes). Thanks, Phil --------------- % cat /tmp/te30.xsl <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt.org/functions" xmlns:test-ns="http://xml.juniper.net/test" version="1.0"> <xsl:template match="/"> <test> <xsl:value-of select="test-ns:test-func()"/> </test> </xsl:template> <func:function name="test-ns:test-func"> <xsl:value-of select="concat("Between ", $x)"/> </func:function> </xsl:stylesheet> % xsltproc /tmp/te30.xsl /tmp/te30.xsl xsltApplySequenceConstructor: value-of was not compiled ELEMENT fake element fake: error : Node has no parent TEXT content= {http://xml.juniper.net/test}test-func: cannot write to result tree while executing a function xmlXPathCompiledEval: evaluation failed runtime error: file /tmp/te30.xsl line 5 element value-of XPath evaluation returned no result. <?xml version="1.0"?> <test xmlns:func="http://exslt.org/functions" xmlns:test-ns="http://xml.juniper.net/test"/> % cat /tmp/te30a.xsl <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt.org/functions" xmlns:test-ns="http://xml.juniper.net/test" version="1.0"> <xsl:template match="/"> <test> <xsl:value-of select="test-ns:test-func()"/> </test> </xsl:template> <func:function name="test-ns:test-func"><xsl:value-of select="concat("Between ", $x)"/></func:function> </xsl:stylesheet> % xsltproc /tmp/te30a.xsl /tmp/te30a.xsl xsltApplySequenceConstructor: value-of was not compiled <?xml version="1.0"?> <test xmlns:func="http://exslt.org/functions" xmlns:test-ns="http://xml.juniper.net/test"/> % diff -u /tmp/te30.xsl /tmp/te30a.xsl --- /tmp/te30.xsl 2012-03-26 14:27:46.000000000 -0400 +++ /tmp/te30a.xsl 2012-03-26 16:02:51.000000000 -0400 @@ -5,7 +5,5 @@ <xsl:value-of select="test-ns:test-func()"/> </test> </xsl:template> - <func:function name="test-ns:test-func"> - <xsl:value-of select="concat("Between ", $x)"/> - </func:function> + <func:function name="test-ns:test-func"><xsl:value-of select="concat("Between ", $x)"/></func:function> </xsl:stylesheet> % xsltproc --version Using libxml 20708, libxslt 10126 and libexslt 815 xsltproc was compiled against libxml 20707, libxslt 10126 and libexslt 815 libxslt 10126 was compiled against libxml 20707 libexslt 815 was compiled against libxml 20707 % _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ xslt@gnome.org http://mail.gnome.org/mailman/listinfo/xslt