Could not find function: empty

A

Abdelhalim

Hello,

I'm using xalan 2.6, and trying to invoke a transformation using XSL
file that contains the function "empty", but I'm getting the below
exception, I think the empty function is a valid XPath function, and
XML Spy can translate docuements using this XSL file without any
problems.

Is it a bug in xalan? I tried 2.7 but I got the same exception.

Any idea what's happening?


javax.xml.transform.TransformerException: Could not find function:
empty
at org.apache.xpath.compiler.XPathParser.error(XPathParser.java:602)
at
org.apache.xpath.compiler.XPathParser.FunctionCall(XPathParser.java:
1449)
at org.apache.xpath.compiler.XPathParser.PrimaryExpr(XPathParser.java:
1388)
at org.apache.xpath.compiler.XPathParser.FilterExpr(XPathParser.java:
1287)
at org.apache.xpath.compiler.XPathParser.PathExpr(XPathParser.java:
1220)
at org.apache.xpath.compiler.XPathParser.UnionExpr(XPathParser.java:
1178)
at org.apache.xpath.compiler.XPathParser.UnaryExpr(XPathParser.java:
1084)
at
org.apache.xpath.compiler.XPathParser.MultiplicativeExpr(XPathParser.java:
1005)
at
org.apache.xpath.compiler.XPathParser.AdditiveExpr(XPathParser.java:
947)
at
org.apache.xpath.compiler.XPathParser.RelationalExpr(XPathParser.java:
872)
 
D

David Carlisle

Abdelhalim said:
Hello,

I'm using xalan 2.6, and trying to invoke a transformation using XSL
file that contains the function "empty",

empty() is an XPath2 function, and xalan implements XSLT 1 and XPath 1.

David
 
J

Justin Johansson

Abdelhalim,

For someone to be able to answer your question you should prune your
stylesheet down as much as possible to isolate the problem. Then you
should post the XSL code to the newsgroup so that people can examine the
problem. You should be able to get the XSL code down to under 20 lines;
anything more and people will be less inclined to offer comments.

Cheers
Justin Johansson
 
J

Joseph Kesselman

David said:
empty() is an XPath2 function, and xalan implements XSLT 1 and XPath 1.

However, depending on what you're doing, there are XPath 1 idioms which
will return equivalent values. For example, to get an empty nodeset you
could ask for the parent of the root node, the children of an attribute,
or similar known-empty paths.
 
M

Martin Honnen

Joseph said:
However, depending on what you're doing, there are XPath 1 idioms which
will return equivalent values. For example, to get an empty nodeset you
could ask for the parent of the root node, the children of an attribute,
or similar known-empty paths.

According to <http://www.w3.org/TR/xquery-operators/#func-empty> the
function returns true if the sequence is empty and false otherwise so
with XPath 1.0 you could use
count($arg) = 0
to check whether arg is empty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top