Re: [xslt] passing info from 'apply' to an EntityLoader

On Fri, Dec 10, 2004 at 12:14:36AM -0500, Clark C. Evans wrote:
> Hello.  I have stylesheets that are used both client side (via
> Firefox) but also server side for HTML-only servers.  When I do a
> document(...) on the client, authentication is taken care of via
> normal mechanism. However, on the server side, I don't know how I
> can pass the current authenticated user session from the 'applyStylesheet' 
> line into where the resolver returns the appropriate content.
> In particular, when I'm applying my stylesheet, I know who my 'user'
> is, and I need this information in my resolver.  I'd like to do
> something like:
> def resolver(URI, ID, cntx):
>     userid = libxslt.getContextParameter(cntx,'userid')
>     ...
> libxml2.setEntityLoader(resolver)
> def transform(userid, ...):
>     ...
>     context = contextParameters(userid='bingles')
>     result = style.applyStylesheet(src, args, context)
> Anything like this possible?  Given that the transform can also
> happen client side I'd rather not use the args (as this is 
> a serverside only thing), but if I can use args, this is _OK_,
> I just don't know how it would work.

  From C you can use the _private pointer in the transformation
context to store informations. But I don't think it's available
from the Python bindings. Another option is to make your authentication
informations parameters to the stylesheet, it should be easier to 
retrieve them from Python.


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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