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 14:37:54 +0200
Message-ID: <4E96DBA2.30306@arcor.de>
To: xproc-dev@w3.org
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" 
     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" 

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" 
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,
Received on Friday, 14 October 2011 22:11:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:09 UTC