W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > April 2009

Default namespaces in XPath

From: <Toman_Vojtech@emc.com>
Date: Mon, 27 Apr 2009 05:00:13 -0400
Message-ID: <6E216CCE0679B5489A61125D0EFEC7870A6DC3B6@CORPUSMX10A.corp.emc.com>
To: <public-xml-processing-model-comments@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 09:03:50 GMT