> I am using the Xalan 1.8 C++ API in a real-time financial application
which need to apply XSLT
> transformations on XML input messages received on-the-fly. On the process
output, I get the
> transformed output XML. In the XSLT stylesheet, I defined several
templates which take input
> parameters (like function calls) and I also defined global XSL variables.
For security reasons, I
> need to log everything. I use the "XalanTransformer" object to make the
transformation and I
> implemented the "TraceListener" object to log most of the
parser/transformer events.
>
> => I am pretty happy with this but I have still have this problem :
> I did not find any way to display the params or global variables values
during the transforming.

Interesting.  We never anticipated anyone would need such a feature.

> I did not find any way to display the params or global variables values
during the transforming.

There really isn't one right now, as you've found.

> I know that a "StylesheetExecutionContext" object implements the
"getVariable()" and
> "getParamVariable()" methods which should allow to do this. The problem
is the
> "StylesheetExecutionContext" provided in the "TracerEvent" and
"SelectionEvent" only
> provide a "const" instance of the "StylesheetExecutionContext" object
which help from calling the
> "getVariable()" and "getParamVariable()" methods which are not "const".
Does anybody know a
> way to log the params/global variable values during the
parsing/transforming ?

As a quick work-around, you could always cast away const on the
StylesheetExecutionContext instance.  I don't think we ever anticipated
anyone would want or need to do somethink like this, and the
StylesheetExecutionContext is const because opening up all of the non-const
functionality isn't the safest thing to do.

We could make the getVariable() and getParamVariable() member functions
const, or at least provide const overloads, but we have to make certain
that calling them will not interfere with processing.  For example, a
global variable is not evaluated until the stylesheet needs its value.
Also, params are not activated until the called template needs them, so
uncontrolled access to variables might be a problem.

I would suggest you file a Bugzilla enhancement request for some way to get
at variables in the TraceListener calls.

> Can anybody tell me what I missed in the Xalan API philosophy ?

In this case, we assume that a TraceListener should not modify the state of
the StylesheetExecutionContext, so we provide a const reference.

Dave

Reply via email to