Subject: RE: 3 XSLT2 quickies
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 17 Mar 2006 16:35:56 -0000
|
> I understand (correctly???) that I can do
>
> <xsl:variable name="x" as="schema-element(a)">
> <xsl:apply-templates select="//foo"/>
> </xsl:variable>
>
>
> The question is, what happens if I run that on a schema-aware
> processor,
> and the <apply-templates.../> evalutates to something which is not a
> valid a element?
You will get a type error.
> can I assume that the variable at run-time is
> really bound to a valid a? And will its descendants be valid, too?
Yes. That's the whole point of the type declaration: it's an assertion about
the type of the value, and the processor guarantees to fail if the assertion
is not true.
Michael Kay
http://www.saxonica.com/
|