- From: Norman Walsh <ndw@nwalsh.com>
- Date: Thu, 01 Sep 2011 10:11:26 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2k49sl5dd.fsf@nwalsh.com>
Florent Georges <fgeorges@fgeorges.org> writes:
>> cat empty-option.xproc
That example didn't test what you think it did :-)
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
<p:option name="opt" select="'test'"/>
<p:choose>
<p:when test="p:value-available('opt')">
<p:choose>
<p:when test="$opt">
<p:identity>
<p:input port="source">
<p:inline>
<when opt="true"/>
</p:inline>
</p:input>
</p:identity>
</p:when>
<p:otherwise>
<p:identity>
<p:input port="source">
<p:inline>
<otherwise opt="false"/>
</p:inline>
</p:input>
</p:identity>
</p:otherwise>
</p:choose>
</p:when>
<p:otherwise>
<p:identity>
<p:input port="source">
<p:inline>
<otherwise opt="undeclared"/>
</p:inline>
</p:input>
</p:identity>
</p:otherwise>
</p:choose>
</p:pipeline>
But in any event, you're absolutely right. XML Calabash gets Effective Boolean
Value completely wrong. It relies on XdmAtomicValue.getBooleanValue() which
has the following JavaDoc:
/**
* Get the value converted to a boolean using the XPath casting rules
* @return the result of converting to a boolean (Note: this is not the same as the
* effective boolean value).
* @throws SaxonApiException if the value cannot be cast to a boolean
*/
Note the note. Sigh.
Fixed now, I think. I'll add some test suite tests for this too.
Be seeing you,
norm
--
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com
Received on Thursday, 1 September 2011 14:12:05 UTC