Re: [xml] adding transformContexts to Python

Daniel Veillard <veillard redhat com> writes:

  Doesn't look crazy to me :-) Tell me if you want this to be applied
  as is or if you prefer doing a bit more testing,

I wrote a test for the resolver access:

  import libxslt
  import libxml2
  import sys
  import StringIO
  import pdb

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

      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

  def test():
      src_doc = libxml2.parseDoc("<a/>")
      style_doc = libxml2.parseDoc("""<?xml version="1.0" encoding="utf-8"?>
      <xsl:stylesheet  version="1.0"
          <xsl:import href="someimport.xslt"/>
          <xsl:template match="/">

      style = libxslt.parseStylesheetDoc(style_doc)
      if style:
          transform_ctxt = style.newTransformContext(src_doc)
          result = style.applyStylesheetUser(src_doc, {}, transform_ctxt)


When I run this on UNPATCHED libxslt (deb 1.1.17-2) it segfaults at
line 9.

It appears that this function:


is the immediate cause of the fault... but I'm guessing the problem is
with the python code putting the values into the C.

I get the same problem with my patched code... can you shed any light
on this?

Nic Ferrier   for all your tapsell ferrier needs

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