Re: [xsl] 3 XSLT2 quickies

Subject: Re: [xsl] 3 XSLT2 quickies
From: Soren Kuula <dongfang@xxxxxxxxxxx>
Date: Fri, 17 Mar 2006 17:53:23 +0100
Michael Kay wrote:

Stand by; can a document node ever, every contain text nodes?

Aren't the specified in XDM or even Infoset, to only have element (exactly one), child or processing-instruction children?




Whenever you write

<xsl:variable name="x">banana</xsl:variable>

you are creating a document node that is the parent of a single text node.


OK, thanks again.

Just a yes / no one:

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? I see something about function conversion rules .. but I'm in doubt what will happen here.


The basic question behind this is from may static analysis: If I statically know the schema declaration of element a (and all its declared descendants), and I see a variable binding elenet / a stylesheet function declaration with as=schema-element(a) (give or tak an OccurenceIndicator), can I assume that the variable at run-time is really bound to a valid a? And will its descendants be valid, too?

If YES, then I will have a really easy time of statically simulating a <copy-of select="$x"/> -- it's a valid a.

My understanding so far is NO.

Soren

Current Thread