0

I am new with eXist and xPath. I am trying to use the lowercase function. Here's my java code.

CompiledExpression compiled = xQueryService.compile("/realestatedata/agents/author/name[lower_case(text())='" + authorName.toLowerCase() + "']");

It gives the following error.

Caused by: org.exist.xquery.XPathException: exerr:ERROR err:XPST0017 Function lower_case()  is not defined in module namespace: http://www.w3.org/2005/xpath-functions [at line 1, column 36] [at line 1, column 36]

I read in the documentation that modules have to be included so I put the following in conf.xml under xquery->builtin-modules.

<module uri="http://www.w3.org/2005/xpath-functions"  class="org.exist.xquery.functions.fn.FnModule" />

I am getting the same error after an exist restart. I've also tried changing the XQueryService from org.xmldb.api.modules.XQueryService to org.xmldb.api.modules.XMLResource

Joe Wicentowski
  • 5,159
  • 16
  • 26
waqas
  • 124
  • 1
  • 10
  • 1
    what about `"/realestatedata/agents/author/name[lower-case(text())='"...`, i.e. with a dash "-" and not underscore "_"? – paul trmbrth Aug 20 '13 at 09:54
  • 1
    @paul-t is right. You misspelled the function name. And there's need to add anything to conf.xml for the XPath functions module to work; these will work out of the box. Also, as your database grows, you can improve performance of these queries by adding an index to the name element. A range index or full text index would be appropriate. See http://exist-db.org/exist/apps/doc/indexing.xml. – Joe Wicentowski Aug 20 '13 at 14:04
  • Thank you. It was a typo. My collection will be a few gb in size so I am going to look at indexes. – waqas Aug 21 '13 at 10:51

1 Answers1

0

You misspelled the function name

"/realestatedata/agents/author/name[lower-case(text())='"

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265