XPTY0004: incompatible XPath operand types
The expression 1 + a string is a type error in XPath. Use a numeric operand or an explicit conversion when the source is known to be numeric. This is an XSLT/XPath check in SaxonC, beyond the browser XML/XSD workbench.
Convert the value to the intended type
The expression 1 + a string is a type error in XPath. Use a numeric operand or an explicit conversion when the source is known to be numeric. This is an XSLT/XPath check in SaxonC, beyond the browser XML/XSD workbench.
Reproduced engine diagnostics and complete fixes
Original minimal examples checked on 2 November 2026. Engine wording differs; follow the cause, not a message alone.
SaxonC-HE 13.1 / saxonche 13.1.1: XPTY0004
XPTY0004 Arithmetic operator is not defined for arguments of types (xs:integer, xs:string)Before (XSLT)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"><xsl:template match="/"><xsl:value-of select="1 + 'a'"/></xsl:template></xsl:stylesheet>After (XSLT)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"><xsl:template match="/"><xsl:value-of select="1 + 2"/></xsl:template></xsl:stylesheet>Input: <r/>. Run both stylesheets with SaxonC; the corrected expression outputs 3. The browser workbench does not execute XSLT. XPath type error reference.
Repeat this check in your workflow
API, Python CLI and GitHub Actions starter are available for automation. The public API is early access; paid CI authentication and SLA are not offered. Pro: US$19/month, 25-file batches and 10 saved schemas. Team: US$49/month, 100-file batches, 100 schemas and five seats.