Re: [xslt] Reading HTML documents using the document() function

Hi Daniel,

Daniel Veillard wrote:

>   Hum, no, there is no such extension at the moment. It seems the best
> way would be to define an extension function in the libxslt namespace:
>     "";
> like document() but called htmldocument() and using the HTML parser.

Yes. In the meantime; for pythoners, this quick and dirty hack seems to 
be working fine (assuming that href is a string):

  def htmldocument(ctx, href):
  	global doc
  	parent = doc.newDocNode(None, 'p', None)
  	newdoc = libxml2.htmlParseFile(href, None)
  	return [parent]

> Does any other XSLT parser provide something similar, it would be best
> to try to reuse the same names if possible.

Not that I am aware of. Most of the XSLT processors rely on SAX/DOM 
parsers which can only read well formed XML...



> Daniel

See you in San Diego.
Eric van der Vlist   

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