Default namespaces in XPath

Suppose I have a pipeline that looks like this:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns="http://foo.com">
  <p:choose>
    <p:when test="... contains(., 'bar') ...">...</p:when>
    <p:otherwise>...</p:otherwise>
  </p:choose>
</p:pipeline>

Does the XPath expression evaluate without errors, or not? I just discovered that with our implementation, it does not, because:

1. The default namespace is "http://foo.com",
2. the default namespace is included in the set of in-scope namespaces of the processor XPath context (section 2.6.1.1),
3. the local function name contains() resolves to {http://foo.com}contains(), which of course does not exist
4. ... and the XPath expression fails

It came as a sort of surprise to me, but perhaps it is just correct and what the XProc specification expects to happen in this case. Or is it a bug in our XPath handling?


Regards,
Vojtech

Received on Monday, 27 April 2009 09:03:49 UTC