Namespace problems in XPath expression with label attribute

Hi All,

I can't get namespaces working in the XPath expression of the label 
attribute in p:label-elements.

What I did and also worked:

A) Declaration of namespace for the step:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" 
xmlns:ns2="http://www.empic.aero/ns/empic-eap/oas"
     version="1.0" name="clean-up-ratings">

B) Using the namespace in match pattern

<p:delete match="ns2:*[@lang and not(@lang='en')]" name="clean-up-lang"/>

C) Using string functions in the XPath expression of the label 
attribute, accessing parent and child elements of the current node,...

<p:label-elements match="ns2:rating-entry" attribute="synchro-id" 
label="string-join(('eap-145',parent::*:rating-entry/*:code,*:code),'-')" replace="true" 
name="init-synchro-id"/>

This already produces the desired result, but you can imagine that I'm 
not happy with it. I did it just this way round to check for other 
obvious mistakes.

Because the following doesn't work:

<p:label-elements match="ns2:rating-entry" attribute="synchro-id" 
label="string-join(('eap-145',parent::ns2:rating-entry/ns2:code,ns2:code),'-')" 
replace="true" name="init-synchro-id"/>

Apparently saxon doesn't see the namespace declaration I made under (A), 
I get the following error message:

   Underlying exception: net.sf.saxon.s9api.SaxonApiException: Prefix 
ns2 has not been declared

Any extra declaration of the namespace needed (where and how?) or just a 
bug? I'm using calabash 0.9.36 (same problem with 0.9.32).

Thanks for clarification,
Georges

Received on Friday, 14 October 2011 22:11:50 UTC