pyxsd.xslt.errors¶
Errors raised by the advisory inspector and the normative XSLT front end.
The advisory inspection error is an input/resource failure only. Normative errors carry the expanded XSLT or XPath error name, the phase that discovered the problem, the stylesheet module and package identity when known, the source location, any frame-derived dynamic stack, and the preserved underlying cause. Static errors use the exact code the specification assigns; a generic exception must never be substituted for one of them.
Errors keep their own identity at XSLT boundaries. A parser, resource, XPath,
or Python exception is wrapped only where the runtime has deliberately converted
it into an XSLT dynamic error; its original object is retained as cause and
__cause__. Callback failures that were not deliberately converted are not
catchable by a coded xsl:catch and are not eligible for implementation
recovery.
Attributes¶
Exceptions¶
Advisory stylesheet inspection could not read or bind its inputs. |
|
Base class for normative XSLT compilation and execution errors. |
|
A static error, reported before any transformation output starts. |
|
A dynamic error raised while executing a transformation. |
|
An engine-detected circularity, reported as |
|
A serialization error, distinct from the transformation's dynamic phase. |
Functions¶
|
Return the local part of one error code without assuming a namespace. |
|
Whether code identifies a static XPath or XSLT error. |
|
Return one error code as an expanded QName when its namespace is known. |
Extract a specification error code from an exception without rewriting it. |
|
|
Whether error is an execution-budget alarm rather than an engine failure. |
Module Contents¶
- pyxsd.xslt.errors.ERROR_NAMESPACE = 'http://www.w3.org/2005/xqt-errors'¶
- pyxsd.xslt.errors.IMPLEMENTATION_BUDGET_CODE = 'PYXSD-XSLT-001'¶
- pyxsd.xslt.errors.UNSUPPORTED_FEATURE_CODE = 'PYXSD-XSLT-002'¶
- pyxsd.xslt.errors.normalized_error_code(code)¶
Return the local part of one error code without assuming a namespace.
- pyxsd.xslt.errors.is_static_error_code(code)¶
Whether code identifies a static XPath or XSLT error.
XPST/XQSTare static XPath/XQuery errors andXTSEis the XSLT static-error family. XSLT 3.0 section 8.3 says static errors are never caught, so these codes stay outsidexsl:tryeven if a processor reports them while executing an expression.
- pyxsd.xslt.errors.expanded_error_code(code)¶
Return one error code as an expanded QName when its namespace is known.
A bare local code belongs to the standard error namespace. A prefixed code with an unknown prefix cannot be expanded without a static context, so it is returned unchanged rather than guessed.
- pyxsd.xslt.errors.error_code_from_exception(error: BaseException, default: None = None) str | None¶
- pyxsd.xslt.errors.error_code_from_exception(error: BaseException, default: str) str
Extract a specification error code from an exception without rewriting it.
Standard error-namespace codes are returned in their familiar local form. A custom QName is preserved as an expanded name so an extension error in a non-standard namespace can still match a coded
xsl:catch. default supplies the fallback used by callers whose boundary maps an unidentifiable failure to a specific error code.
- exception pyxsd.xslt.errors.XsltInspectionError¶
Advisory stylesheet inspection could not read or bind its inputs.
This is an input/resource failure, not an XSLT static error. Schema legality findings and instance binding findings are reported on
reportinstead.
- exception pyxsd.xslt.errors.XsltError(message, *, code=None, phase=None, uri=None, module=None, package=None, location=None, stack=(), cause=None, description=None, has_description=True, value=(), line_number=None, column_number=None)¶
Base class for normative XSLT compilation and execution errors.
codeis an XSLT (XTSE/XTTE/XTDE) or XPath (XPST/XPTY) error code, stored as supplied.phasenames the processing phase,uri/modulethe relevant stylesheet or resource,packagethe containing package, andlocationone source occurrence.stackis derived from explicit execution frames, never from the Python call stack.causepreserves a parser, resource, expression, or callback exception instead of replacing its identity with this error.description,value,line_number, andcolumn_numbercarry the standarderr:*catch metadata.has_descriptiondistinguishes an explicitly absent description (fn:errorwith one argument) from an empty one. Line and column numbers remainNonewhen the source occurrence does not carry them.- Parameters:
message (str)
code (str | None)
phase (str | None)
uri (str | None)
module (str | None)
package (str | None)
location (pyxsd.locations.IssueLocation | None)
stack (collections.abc.Sequence[pyxsd.xslt.runtime.frames.FrameDiagnostic])
cause (BaseException | None)
description (str | None)
has_description (bool)
value (collections.abc.Sequence[object])
line_number (int | None)
column_number (int | None)
- code = None¶
- phase = None¶
- uri = None¶
- module = None¶
- package = None¶
- location = None¶
- cause = None¶
- description¶
- has_description = True¶
- value: tuple[pyxsd.xdm.XdmItem, ...] = ()¶
- messages: tuple[pyxsd.xslt.results.Message, ...] = ()¶
- line_number = None¶
- column_number = None¶
- property expanded_code: str | None¶
The error code as an expanded QName, when its namespace is known.
- Return type:
str | None
- property catchable: bool¶
Whether a coded
xsl:catchmay consume this error.Only dynamically signaled XSLT/XPath errors are catchable. Static and serialization errors are outside
xsl:try, and a foreign callback failure is not converted merely because it crossed an XSLT boundary.- Return type:
- matches_catch(errors=None, *, namespaces=None)¶
Whether one
xsl:catch/@errorslist selects this error.- Parameters:
errors (collections.abc.Iterable[str] | str | None)
namespaces (collections.abc.Mapping[str, str] | None)
- Return type:
- attach_diagnostics(stack, *, module=None, package=None)¶
Attach frame-derived context only where it is not already known.
- Parameters:
stack (collections.abc.Sequence[pyxsd.xslt.runtime.frames.FrameDiagnostic])
module (str | None)
package (str | None)
- Return type:
None
- attach_messages(messages, warnings)¶
Retain messages and warnings emitted before this failure.
A failed transformation never returns a result, so its diagnostics would otherwise be lost at the host boundary. Messages already attached by an inner invocation stay first; the outer invocation’s own messages follow.
- Parameters:
messages (collections.abc.Sequence[pyxsd.xslt.results.Message])
warnings (collections.abc.Sequence[str])
- Return type:
None
- exception pyxsd.xslt.errors.XsltStaticError(message, *, code=None, phase='static', uri=None, module=None, package=None, location=None, stack=(), cause=None, description=None, has_description=True, value=(), line_number=None, column_number=None)¶
A static error, reported before any transformation output starts.
A static-expression failure keeps its original XPath code; a stylesheet resource or structural failure uses the exact
XTSEcode for that rule.- Parameters:
message (str)
code (str | None)
phase (str)
uri (str | None)
module (str | None)
package (str | None)
location (pyxsd.locations.IssueLocation | None)
stack (collections.abc.Sequence[pyxsd.xslt.runtime.frames.FrameDiagnostic])
cause (BaseException | None)
description (str | None)
has_description (bool)
value (collections.abc.Sequence[object])
line_number (int | None)
column_number (int | None)
- exception pyxsd.xslt.errors.XsltDynamicError(message, *, code=None, phase='dynamic', uri=None, module=None, package=None, location=None, stack=(), cause=None, allow_catch=True, description=None, has_description=True, value=(), line_number=None, column_number=None)¶
A dynamic error raised while executing a transformation.
codeis normally an XSLTXTDE/XTTEcode or an XPath error code. The execution runtime’s own resource limits use the stable implementation codePYXSD-XSLT-001; callers can test it exactly without depending on message text.allow_catchis false for foreign callback failures that crossed an XSLT boundary without being deliberately converted.- Parameters:
message (str)
code (str | None)
phase (str)
uri (str | None)
module (str | None)
package (str | None)
location (pyxsd.locations.IssueLocation | None)
stack (collections.abc.Sequence[pyxsd.xslt.runtime.frames.FrameDiagnostic])
cause (BaseException | None)
allow_catch (bool)
description (str | None)
has_description (bool)
value (collections.abc.Sequence[object])
line_number (int | None)
column_number (int | None)
- allow_catch = True¶
- exception pyxsd.xslt.errors.XsltCircularityError(message, **kwargs)¶
An engine-detected circularity, reported as
XTDE0640.XSLT 3.0 section 5.5.4 makes a dynamic error during pattern evaluation a non-match, but requires a circularity to be reported even there. This marker distinguishes the engine’s own circularity from an unrelated dynamic error that happens to carry the same code (for example a forged
xsl:messagecode), which the masking rule still covers.- Parameters:
message (str)
kwargs (Any)
- exception pyxsd.xslt.errors.XsltSerializationError(message, *, code=None, phase='serialization', uri=None, module=None, package=None, location=None, stack=(), cause=None, secondary=False, description=None, has_description=True, value=(), line_number=None, column_number=None)¶
A serialization error, distinct from the transformation’s dynamic phase.
A serialization error while writing a secondary result is treated as a dynamic error of the
xsl:result-documentinstruction and may be caught; a principal-result serialization error happens after the transformation and cannot be caught.secondaryrecords which boundary raised it.- Parameters:
message (str)
code (str | None)
phase (str)
uri (str | None)
module (str | None)
package (str | None)
location (pyxsd.locations.IssueLocation | None)
stack (collections.abc.Sequence[pyxsd.xslt.runtime.frames.FrameDiagnostic])
cause (BaseException | None)
secondary (bool)
description (str | None)
has_description (bool)
value (collections.abc.Sequence[object])
line_number (int | None)
column_number (int | None)
- secondary = False¶
- pyxsd.xslt.errors.is_budget_alarm(error)¶
Whether error is an execution-budget alarm rather than an engine failure.
Two independent budgets can expire while the engine works, and neither one describes a failure of the stylesheet or of the expression being evaluated:
the caller’s wall-clock alarm, which the conformance harness raises as a
TimeoutErrorfromSIGALRM; andthe engine’s own
ExecutionLimitsbudget, which arrives as a dynamic error carryingIMPLEMENTATION_BUDGET_CODE.
A handler that converts a caught exception into a non-match or a different error must let both through unchanged. Converting the alarm cancels the bound the caller placed on the work, so the runaway expression keeps running instead of stopping at its budget.
TimeoutErroris class-only:socket.timeout,asyncio.TimeoutErrorandconcurrent.futures.TimeoutErrorare that class on Python 3.11+, so a foreign timeout arriving at a guarded engine site is treated as an alarm. Extension and Python-rule callbacks are converted at their own boundary before this predicate ever sees the error.- Parameters:
error (BaseException)
- Return type: