Re: [xsl] How to produce a record of changes made in an identity transform?

Subject: Re: [xsl] How to produce a record of changes made in an identity transform?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 28 Jul 2004 12:24:36 +0100
This is really like a table of contents, so the canonical way of
proceeding is to process the document twice, with two modes

<xsl:template match="/">
<xsl:result-document ....>
 <xsl:apply-templates mode="log"/>
</xsl:result document>

You then just duplicate every 
<xsl:template match="something">
that's doing something otherthan an identity and have
<xsl:template match="something" mode=log">
 I did something

If reprocessing the document twice and duplicating the templates doesn't
feel right then an alternative plan (which isn't really following the
one-true-path to functional programming purity is to stick an 
I did something
into any template that does anything, then use your command line or API
to redirect the xsl:message output to your log file.

Note however that the first way is guaranteed to produce the log in a
logical order, the second way will most likely produce the log in the
order that the system actually evaluated the templates, which if you
have some (perhaps mythical) highly parralelised and optimised xslt
engine mightbe in any order at all.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread