Think of the division between @as and xsl:assert in the following way:
If what you want to check is the type of a single variable as optional/one or
more/any of a given type attach @as to the defining statement (xsl:variable,
xsl:param, xsl:sequence). As Michael says, the compiler can do much more with
that, either in static or dynamic phases.
If you need to check something much more complex (e..g. count(items) > 6,
$node/parent::container[count(*) gt 5]), add an xsl:assert ‘instruction’.
John Lumley
On 6 May 2022, at 20:02, Roger L Costello costello(_at_)mitre(_dot_)org
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Michael Kay wrote:
--------------------------------------------------------------------------
If you can express the condition with an @as attribute,
use that in preference to an xsl:assert, because it's much
more amenable to static analysis - certainly with Saxon,
xsl:assert will only ever give you a run-time error. The
diagnostics for type errors will also tend to be better.
--------------------------------------------------------------------------
Fantastic!
Thank you Michael.
/Roger
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--