xsl-list
[Top] [All Lists]

RE: [xsl] 3 XSLT2 quickies

2006-03-17 09:36:19
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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>