Re: TclXSLT question: best approach?



Having just celebrated my birthday (29... again!), I'm am feeling a bit
more gray. To answer the obvious question: How old am I? I'm old
enough to know better, but young enough not to care!

Your approach looks fine to me. The idea of transforming XML into a
Tcl script using XSLT and then eval'ing it is something I've been doing
quite alot lately. I've also done a system on Windows using DOS batch
scripting in the same fashion (but relatively clunky compared to the
use of Tcl).

As far as the -method option is concerned, you must specify it to the
dom::serialize command because the dom package is separate to the xslt
package. At that point in the document's lifecycle it simply does not
know that its intended serialisation is as text rather than as XML. In
fact, there's nothing to stop you from producing an XML result document
and then serialising it as text, or vice versa. The style***
provides an option for retrieving the serialisation method, so you can
do this:

dom::serialize $txtdoc -method [$listify cget -method]

I believe this method of connecting the dom and xslt packages is more
"Tcl-friendly". It's kind of like connecting a scrollable widget to a
scrollbar.

HTHs,
Steve Ball

.


Quantcast