Re: Namespace problems in XPath expression with label attribute

Hi,

I tried more or less a similar thing with *calumet*, I get

a) no error message but
b) also no result for elements with "ns2" prefix as shown under point C) 
below.

Any hint appreciated. Point me to some documentation, if it is just a 
question of not knowing all the details.

Georges

Am 13.10.2011 14:37, schrieb Georges Schmitz:
> 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 Sunday, 23 October 2011 20:48:51 UTC