W3C home > Mailing lists > Public > xproc-dev@w3.org > October 2011

Namespace problems in XPath expression with label attribute

From: Georges Schmitz <georges.schmitz@arcor.de>
Date: Thu, 13 Oct 2011 09:30:53 +0200
Message-ID: <4E9693AD.70706@arcor.de>
To: xproc-dev@w3.org
Hi All,

I can't get namespaces working in the XPath expression of the label 
attribute.

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:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 14 October 2011 22:11:51 GMT