Re: [xml] varying entity resolution (was Re: adding transformContexts to Python)

On Fri, Sep 01, 2006 at 03:58:18PM +0100, Nic James Ferrier wrote:
Replying to myself:

I wrote a test for the resolver access:


  def xslt_resolver(url, id, ctxt):
      pctxt = libxslt.xpathParserContext(_obj=ctxt)
      xpc = pctxt.context()

      if url == "someimport.xslt":
          f = StringIO.StringIO("""<?xml version="1.0" encoding="utf-8"?>
  <xsl:stylesheet  version="1.0"
      <xsl:template match="/xxx">
          return f
      return None

This breaks.

I really wanted to be able to access the xsltTransformContext from

But it appears that I've been wrong about this... the ctxt delivered
to the resolver is an xmlParserCtxt, not an
xpathParserContext. Moreover the xmlParserCtxt doesn't seem to have
anyway of getting to an xpathParserContext or an xsltTransformContext.

The reason I wanted to be able to reach the tranform context was so
that I could uniquely identify a transformation.

I've got a webapp where users can have personalized copies of common
xslts. In the resolver I want to be able to say:

- what request is this resolution associated with?

- what is the user's id (from the http request)

- what is the correct directory to search for xslt imports and other

If I can't do this by getting the transformContext can anyone suggest
how I might do it?

  Hum, for Apple/Safari we added xsltSetLoaderFunc() in documents.h
I'm really busy right now, I can't really go though code or review
in the next days, but I guess it's a hint in the right direction for you,


Red Hat Virtualization group
Daniel Veillard      | virtualization library
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]