Re: [xsl] Conditional Include statements

Subject: Re: [xsl] Conditional Include statements
From: "C. M. Sperberg-McQueen" <cmsmcq@xxxxxxxxxxxxxxxxx>
Date: Thu, 2 Apr 2009 17:53:31 -0600
On 1 Apr 2009, at 23:32 , Vyacheslav Sedov wrote:

i can use doc(' ') to get stylesheet itself, then modify it, and at
last apply modified stylesheet to input document

why not?

You can indeed. And (depending on how well you or the maintenance programmer understands the structure of the modified stylesheet that is actually processing the input) there may be no reason at all why not. Don't imagine I disapprove on principle.

But I do maintain that this is not the same kind of
self-modification that computer scientists played with and practical
programmers used (as Michael Kay said) in the 1950s and 1960s
(and in some cases later).  The differences may not be crucial
to what you want to do -- but they are crucial to the
maintainability and understandability of the program.
Dynamic generation of a program may be easy or hard to
understand, but it will almost always be simpler and easier
to understand and debug than self-modification in place.

One important difference: while debugging a system of the kind
you describe, you can write out the source code for the modified
stylesheet and study it.  The source you study is the same
source as the XSLT processor will be compiling and running.
That kind of inspection of the generated code is not possible
in the same way with programs that overwrite their binary form
in memory with different machine instructions, in binary.
That difference and others like it are, in turn, why I'm happy
for Saxon to have a transform() function, but would be less
happy to have it offer dynamic self-modification of a
running stylesheet (by, say, adding new templates).

Your mileage, of course, may vary.

* C. M. Sperberg-McQueen, Black Mesa Technologies LLC

Current Thread