[xslt] adding my own data to transformer context ?



Is there a clean way to add information to the
transform context object ?  Here is my motivation:

I need to pass an argument to document() as a C 
string rather than an actual file since it's not
in a real file.  At first I thought I could 
register some kind of URL handler so that when
it sees "string:/foo" it would find a string
defined in a (additional) hash table in the 
transform context name "foo"  and process it.
But then I realized this wouldn't work because
the URL handler would only see "foo" and doesn't
have access to the transform context where the
association between "foo" and the actual string
is stored (because the transform context pointer
isn't passed to the URL handler).

I found a function named xmlSaxParseMemory (or
something similar) which looks like what I need.
However, the real issue is how to add my own 
information to the transform context.

First problem: I notice that some structures have
a private pointer which I could use to store a
pointer to my own stuff, but xsltTransformContext
does not.

Second problem: xsltApplyStyleSheetInternal 
constructs the transform context and then does
everything else without letting the caller do
anything to the transform context.  it would
be useful if the caller could pass in an 
already constructed transform context which
would be used instead of building a new one.
Then a caller could (a) build a transform context,
(b) add some things to it using the private pointer
and then (c) call xsltApplyStyleSheetInternal to
do the hard work.

Third problem: If there is a way for the caller
to pass in an already constructed transform 
context then there should be a way for the caller
to do the destruction also perhaps by storing the
address of a callback routine in the transform 
context when it is constructed.

Tom Moog
Polhode, Inc.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]