Re: A case of superfluous type checking for parameters (p:with-param and xsl:param) ?

Manfred Staudinger <manfred.staudinger@gmail.com> writes:
> Using XML Calabash, v1.0.2 (for Saxon 9.4.x). In my pipeline I have a
> p:xslt step with
>    <p:with-param name="scale" select="$scale"><p:empty/></p:with-param>
> where $scale is a required option from the command line. The parameter
> to be received in the XSLT is defined with
>    <xsl:param name="scale" as="xs:decimal"/>
> and this results in an error: "XPTY0004:Required item type of value of
> variable $scale is xs:decimal; supplied value has item type
> xs:string".

I was just looking at this bit of code the other day. Do you have the
allow-general-expressions extension enabled?

It sounds like a bug to me, if you can reproduce it with a small test
case and post it in the issue tracker

  https://github.com/ndw/xmlcalabash1/issues

I'll fix it asap.

> Q1: Can Calabash drop this check?

It's not on purpose. :-)

> Q2: The best workaround for the user?

If you're using the general expressions extension, try casting explicitly
to xs:decimal yourself:

  <p:with-param name="scale" select="xs:decimal($scale)">...

If not, then I'm even more confused.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Thursday, 16 February 2012 17:29:27 UTC