XSLT & Saxon Error Reference
The most common XSLT and Saxon error codes and parser messages, explained in plain English: what each error means, what typically causes it, and how to fix it — with before/after examples you can verify in the online XSLT editor.
Saxon error codes follow the W3C convention: XPST (XPath static), XPDY (XPath dynamic), XPTY (XPath type), XTSE (XSLT static), XTDE (XSLT dynamic), FO* (function library). Parser messages such as "Content is not allowed in prolog" come from the underlying XML parser and mean the input is not well-formed XML. Also see the XSLT & XPath function reference.
Function errors
- FODC0002 All versions doc() or document() could not load the requested document: wrong relative URI, missing …
- FORG0001 XSLT 2.0+ A cast or constructor function received a value it cannot convert — casting text to a …
- FORX0002 XSLT 2.0+ The pattern given to matches(), replace(), tokenize() or xsl:analyze-string is not a valid …
XML parsing errors
- Content is not allowed in prolog All versions The XML parser found characters before the XML declaration or root element: usually a …
- Markup in the document following the root element must be well-formed All versions There is content after the closing tag of the root element — usually two XML documents …
- SXXP0003 All versions A Saxon wrapper code: the source document failed to parse as XML. The real diagnosis is in …
- The entity name must immediately follow the '&' All versions A raw ampersand appears in the XML. In XML, & always starts an entity reference — literal …
XPath dynamic errors
- XPDY0002 XSLT 2.0+ An expression uses a relative path (./foo, foo/bar) in a place where there is no context …
XPath static errors
- XPST0008 All versions An XPath expression references a variable that does not exist at that point: a typo, or a …
- XPST0017 All versions Saxon cannot resolve a function call: the function name is unknown, the number of …
- XPST0081 All versions An XPath expression uses a namespace prefix that is not declared in the stylesheet. …
XPath type errors
- XPTY0004 XSLT 2.0+ A type error: an expression returned a sequence or type that does not match what the …
XSLT dynamic errors
XSLT recoverable errors
- XTRE0540 All versions Two or more templates match the same node with equal priority. Saxon warns (or errors in …