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



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?

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs



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