RE: incorrect XPath evaluation in label attribute with calumet [was: Namespace problems in XPath expression with label attribute]

Georges,

What version of Calumet are you using? Version 1.0.12 indeed has this problem, but it seems to have been fixed in 1.0.13 (as part of another p:label-elements bug - see the change log).

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

From: Georges Schmitz [mailto:georges.schmitz@arcor.de]
Sent: Thursday, November 03, 2011 12:42 AM
To: xproc-dev@w3.org
Cc: Toman, Vojtech
Subject: incorrect XPath evaluation in label attribute with calumet [was: Namespace problems in XPath expression with label attribute]

Hi Vojtech,

after the fix in calabash the result form calabash differs from calumet. As I stated in my last mail, it seems that child elements are not evaluated correctly in calumet for the label attibute. I refer to the last term in the XPath expression of the label attribute:
"ns2:code" in the concat() function of
label="concat('eap-145','-', parent::ns2:rating-entry/ns2:code, '-', ns2:code)"

The result should resemble to what I listed under E), the calumet output is shown in C). I tested with calumet 1.0.12.

Thanks,
Georges

Am 25.10.2011 00:52, schrieb Georges Schmitz:

A) The PIPELINE could be as simple as this one:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"<http://www.w3.org/ns/xproc> xmlns:ns2="http://www.empic.aero/ns/empic-eap/oas"<http://www.empic.aero/ns/empic-eap/oas>
    version="1.0" name="clean-up-ratings">
    <p:input port="source" primary="true">
        <p:empty/>
    </p:input>
    <p:output port="result"/>

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

</p:declare-step>

B) the INPUT document

<rating-system-export xmlns:ns2="http://www.empic.aero/ns/empic-eap/oas"<http://www.empic.aero/ns/empic-eap/oas>>
    <ns2:rating-root >
        <ns2:name>EASA 145</ns2:name>
        <ns2:rating-entry >
            <ns2:code>A</ns2:code>
            <ns2:text xml:lang="en">Aircraft</ns2:text>
            <ns2:rating-entry >
                <ns2:code>A1</ns2:code>
                <ns2:text xml:lang="en">Aeroplane above 5700 kg</ns2:text>
                <ns2:rating-entry >
                    <ns2:code>DUMMY</ns2:code>
                    <ns2:text xml:lang="en">Will state aeroplane/ series or type and/or the maintenance task(s)</ns2:text>
                </ns2:rating-entry>
            </ns2:rating-entry>
        </ns2:rating-entry>
    </ns2:rating-root>
</rating-system-export>

C) CALUMET OUTPUT:

<rating-system-export xmlns:ns2="http://www.empic.aero/ns/empic-eap/oas"<http://www.empic.aero/ns/empic-eap/oas>>
    <ns2:rating-root>
        <ns2:name>EASA 145</ns2:name>
        <ns2:rating-entry synchro-id="eap-145--">
            <ns2:code>A</ns2:code>
            <ns2:text xml:lang="en">Aircraft</ns2:text>
            <ns2:rating-entry synchro-id="eap-145-A-">
                <ns2:code>A1</ns2:code>
                <ns2:text xml:lang="en">Aeroplane above 5700 kg</ns2:text>
                <ns2:rating-entry synchro-id="eap-145-A1-">
                    <ns2:code>DUMMY</ns2:code>
                    <ns2:text xml:lang="en">Will state aeroplane/ series or type and/or the maintenance task(s)</ns2:text>
                </ns2:rating-entry>
            </ns2:rating-entry>
        </ns2:rating-entry>
    </ns2:rating-root>
</rating-system-export>

==>> the direct child element "ns2:code" is not evaluated, the last synchro-id attribute should be "eap-145-A1-DUMMY", but "DUMMY" is missing.

D) NO OUTPUT with CALABASH, exception instead:

25.10.2011 00:43:49 com.xmlcalabash.util.DefaultXProcMessageListener error
SCHWERWIEGEND: cleanup-lang-and-customer.xpl:10:149:err:XD0023:Expression could not be evaluated
25.10.2011 00:43:49 com.xmlcalabash.drivers.Main error
SCHWERWIEGEND: It is a dynamic error if an XPath expression is encountered which cannot be evaluated (because it is syntactically incorrect, contains references to unbound variables or unknown functio
ns, or for any other reason).
25.10.2011 00:43:49 com.xmlcalabash.drivers.Main error
SCHWERWIEGEND: Underlying exception: net.sf.saxon.s9api.SaxonApiException: Prefix ns2 has not been declared

E) replace "ns2" with "*" in the label attribute of the pipeline
label="concat('eap-145','-', parent::*:rating-entry/*:code, '-', *:code)"
and run it again with calabash gives me finally the expected result (but using the * wildcard is not satisfying and furthermore it doesn't work with calumet):

<rating-system-export xmlns:ns2="http://www.empic.aero/ns/empic-eap/oas"<http://www.empic.aero/ns/empic-eap/oas>>
    <ns2:rating-root>
        <ns2:name>EASA 145</ns2:name>
        <ns2:rating-entry synchro-id="eap-145--A">
            <ns2:code>A</ns2:code>
            <ns2:text xml:lang="en">Aircraft</ns2:text>
            <ns2:rating-entry synchro-id="eap-145-A-A1">
                <ns2:code>A1</ns2:code>
                <ns2:text xml:lang="en">Aeroplane above 5700 kg</ns2:text>
                <ns2:rating-entry synchro-id="eap-145-A1-DUMMY">
                    <ns2:code>DUMMY</ns2:code>
                    <ns2:text xml:lang="en">Will state aeroplane/ series or type and/or the maintenance task(s)</ns2:text>
                </ns2:rating-entry>
            </ns2:rating-entry>
        </ns2:rating-entry>
    </ns2:rating-root>
</rating-system-export>

Hope these examples are detailed enough to identify the problems in both tools.

Greetings,
Georges

Received on Friday, 4 November 2011 10:04:54 UTC