I recently upgraded to Saxon 8.8b (Java) from 8.7 and started getting this error message:

java.lang.ClassCastException: net.sf.saxon.value.StringValue
    at net.sf.saxon.expr.ArithmeticExpression$NumericArithmetic.doArithmetic (ArithmeticExpression.java:737)
    at net.sf.saxon.expr.ArithmeticExpression$NumericArithmetic.evaluateItem(ArithmeticExpression.java:674)
    at net.sf.saxon.instruct.SimpleContentConstructor.evaluateItem(SimpleContentConstructor.java :199)
    at net.sf.saxon.instruct.ValueOf.processLeavingTail(ValueOf.java:198)
    at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:352)
    at net.sf.saxon.instruct.Template.applyLeavingTail (Template.java:99)
    at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:319)
    at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:351)
    at net.sf.saxon.instruct.ApplyTemplates.applyTemplates (ApplyTemplates.java:312)
    at net.sf.saxon.Controller.transformDocument(Controller.java:1602)
    at net.sf.saxon.Controller.transform(Controller.java:1426)
    at net.sf.saxon.Transform.processFile(Transform.java :828)
    at net.sf.saxon.Transform.doTransform(Transform.java:495)
    at net.sf.saxon.Transform.main(Transform.java:60)

I reduced the problem down to this in the stylesheet:

<xsl:variable name="a">
    <xsl:choose>
        <xsl:when test="1=1">4</xsl:when>
    </xsl:choose>
</xsl:variable>

<xsl:value-of select="$a - 1"/>

Using an <xsl:sequence select="4"/> inside the when statement works properly (and I should have done that in the first place). I was just wondering if this should be throwing a Java ClassCastException?

thanks,
Matt Thomas