Subject: Re: [xsl] Request for XSLT2.0 / XML Schema triples From: Soren Kuula <dongfang@xxxxxxxxxxx> Date: Tue, 29 Nov 2005 00:41:27 +0100 |
Hi Soren,It isn't really; it works by ... aargh do you expect me to KNOW that? :) Well, for each template rule, it can determine with good accuracy a set of node types that may be context nodes at some instantiation (is it called that? Execution. Invocation. Whateveration) of the template rule. For each type, is can compute the set of template rules that are invoked at any apply-templates (or other recursion instruction). Then, we get a context flow graph (looks like a control flow graph), and by some black magic (let me write the report first, OK?), a summary graph is constructed, describing a tight superlanguage of the regular tree language that the transform may generate, given that its input is valid by the input schema. Then, the summary graph is (more black magic) validated against the output schema.
Having public access to your analyser will be very useful.
It seems to be a kind of type-inference engine. I wonder whether
Michael Kay is not already doing something like this (of course I
can't know as I've never tried his SA Saxon).
No. I have not emphasized on functions (they are so inherently hard to analyze generally that there it little point in even just trying). It will just be translated to a different function, defined as spewing out completely unknown stuff all the time.It is interesting whether such kind of type inference can be done statically, or if it generally requires dynamic analysis.
One example is:
<xsl:function name="f:foo" as="item()*">
<!-- Code, producing *always* a non-empty sequence of elements -->
</xsl:function>
Will your analyser confirm the fact that f:foo() is producing element()+ ?
<xsl:template match="/"> <cow> <xsl:apply-templates/> </cow> </xsl:template>
<xsl:template match="foo | bar"> <goat> </goat> <xsl:apply-templates/> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Request for XSLT2.0 / XML, Dimitre Novatchev | Thread | RE: [xsl] Request for XSLT2.0 / XML, Michael Kay |
RE: [xsl] Request for XSLT2.0 / XML, Michael Kay | Date | RE: [xsl] XSLT in UML, Michael Kay |
Month |