XSLT Error Reference
FORG0001
Error message
Invalid value for cast/constructor: xs:integer("abc")A cast or constructor function received a value it cannot convert — casting text to a number or date is the usual suspect. Guard with 'castable as' or use number().
What it means
A constructor like xs:integer(...), xs:date(...) or an implicit cast received a lexical value that is not valid for the target type: xs:integer('abc'), xs:date('2026-13-45'), or an empty string.
Common causes
- Dirty or empty data — casting
@qtywhen some elements haveqty="". - Format mismatch —
xs:date('02/07/2026'): XSD dates must be2026-07-02. - Locale-style numbers —
xs:decimal('1.234,56')fails; XSD uses.as decimal separator only.
How to fix it
- Guard the cast:
<xsl:value-of select="if (@qty castable as xs:integer)
then xs:integer(@qty) else 0"/>
- Or use
number()when NaN is acceptable:number('abc')returnsNaNinstead of raising an error — handy for optional numeric fields. - Normalize the lexical form first (
translate(),replace(), format-date patterns) before casting dates and decimals.