xsl-list
[Top] [All Lists]

Re: [xsl] 3 XSLT2 quickies

2006-03-17 09:29:45
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

--~------------------------------------------------------------------
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>