[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: The output of evaluating an XSLT transform is the
> QUESTION #1 > > Why do you now say "XSLT instructions"? Because that's what the XSLT specification calls them. But semantically, they are expressions. In fact, XSLT 1.0 did use the kind of language you are using, of instructions "writing to a result tree", which sounds like a side effect. XSLT 2.0 changed that - largely in response to a proposal from Jeni Tennison - to a semantic model in which instructions return results; but the term "instruction" was retained. > > The elements in an XSLT document can be executed in any > order, even in parallel. > > Yesterday I thought that I had it all figured out: the > in-memory result tree can be constructed in any order, even > in parallel. However, from yesterday's responses, I am more > confused than before. Would you (or anyone) please explain > how the elements in an XSLT document can be executed in any > order, even in parallel? Consider any expression that has subexpressions: x() + y() + z() x(), y(), z() In each case the result of the final expression depends on the values of x, y, and z, but (i) x(), y(), and z() do not depend on each other, and (ii) evaluating x, y, or z has no side-effects; so in each case, it does not matter what order x, y, and z are evaluated in. In XSLT the construct <a> <xsl:apply-templates select="x"/> <xsl:apply-templates select="y"/> <xsl:apply-templates select="z"/> </a> is very like the second expression (x(), y(), z()). The three functions can be evaluated in any order or in parallel. The results have to be assembled in the correct order, but the evaluation does not need to be sequential. This is quite different from a language such as Java, where you need to evaluate x() before you evaluate y(), because evaluating x() can have side-effects (such as updating global variables) that affect the result of evaluating y(). Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|