Fabian
Fabian

Reputation: 2000

How are XSLT files processed?

I was just wondering, how are XSLT files processed. How are they interpreted and executed?

Are XSLT files read line-by-line and "executed" immediately like a scripting language? Or is always the entire file read first and statements get executed only if the entire XSLT code is well-formed? Or.... ????

(Please note, I'm a C++ programmer with first day XSLT conntact. The only thing I've figured out, is that XSLT most probably does not get compiled into machine code. :-) )

Upvotes: 2

Views: 75

Answers (1)

Michael Kay
Michael Kay

Reputation: 163262

It will vary from one XSLT processor to another. You can probably assume that the whole stylesheet is read, validated, and converted to some internal representation, which may then be optimized using rewrite rules, and the internal representation is then executed by some kind of interpreter. The more advanced processors, such as Saxon-EE, do generate instructions - not machine instructions, but some kind of intermediate language such as Java bytecode, or perhaps a custom instruction set for the interpreter to execute.

Upvotes: 4

Related Questions