after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
possibly diagnostic and extremely irritating is that I can't back out to my previous version of lxml.
-w
------------------------------------------------------------------------
# ganked from z0pt and sfive import os from StringIO import StringIO
slug = """ <div><some tag="true"> <other /> </some> </div> """
def xstrip(text): """ strip out whitespace >>> print xstrip(slug) <div><some tag="true"><other></other></some></div> ... """ if not text: return '' from lxml import etree xsltfile = os.path.join(os.path.dirname(__file__), 'strip.xsl') xslt = open(xsltfile) xslt_doc = etree.parse(xslt) style = etree.XSLT(xslt_doc) xslt.close() doc = etree.fromstring(text) result = style(doc) return str(result)
import unittest from zope.testing import doctest optionflags = doctest.REPORT_ONLY_FIRST_FAILURE | doctest.ELLIPSIS def test_suite():
return unittest.TestSuite(( doctest.DocTestSuite('xml', optionflags=optionflags) ))
if __name__=="__main__": unittest.TextTestRunner().run(test_suite())
------------------------------------------------------------------------
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet>
-- | david "whit" morriss | | contact :: http://public.xdi.org/=whit "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 "I like to write code like other ppl like to tune their cars or 10kW hifi equipment..." Christian Heimes, 2004