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

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:
> 
> <snip/>
> 
> >   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"
> >                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >       <xsl:template match="/xxx">
> >           <sexy/>
> >       </xsl:template>
> >   </xsl:stylesheet>
> >   """)
> >           return f
> >       return None
> 
> This breaks.
> 
> 
> I really wanted to be able to access the xsltTransformContext from
> here.
> 
> 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
>   entities?
> 
> 
> 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,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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