@@ -287,8 +287,7 @@ xsltLoadHtmlDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
287287 ret = ret -> next ;
288288 }
289289
290- doc = xsltHtmlDocLoader (URI , ctxt -> dict , ctxt -> parserOptions ,
291- (void * ) ctxt , XSLT_LOAD_DOCUMENT );
290+ doc = htmlReadFile (URI , NULL , ctxt -> parserOptions | HTML_PARSE_RECOVER );
292291
293292 if (doc == NULL )
294293 return (NULL );
@@ -316,71 +315,4 @@ xsltLoadHtmlDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
316315
317316 ret = xsltNewDocument (ctxt , doc );
318317 return (ret );
319- }
320-
321- /**
322- * xsltDocDefaultLoaderFunc:
323- * @URI: the URI of the document to load
324- * @dict: the dictionary to use when parsing that document
325- * @options: parsing options, a set of xmlParserOption
326- * @ctxt: the context, either a stylesheet or a transformation context
327- * @type: the xsltLoadType indicating the kind of loading required
328- *
329- * Default function to load document not provided by the compilation or
330- * transformation API themselve, for example when an xsl:import,
331- * xsl:include is found at compilation time or when a document()
332- * call is made at runtime.
333- *
334- * Returns the pointer to the document (which will be modified and
335- * freed by the engine later), or NULL in case of error.
336- */
337- static xmlDocPtr
338- xsltHtmlDocLoader (const xmlChar * URI , xmlDictPtr dict , int options ,
339- void * ctxt ATTRIBUTE_UNUSED ,
340- xsltLoadType type ATTRIBUTE_UNUSED )
341- {
342- xmlParserCtxtPtr pctxt ;
343- xmlParserInputPtr inputStream ;
344- xmlDocPtr doc ;
345-
346-
347-
348- pctxt = htmlNewParserCtxt ();
349- if (pctxt == NULL )
350- return (NULL );
351- if ((dict != NULL ) && (pctxt -> dict != NULL )) {
352- xmlDictFree (pctxt -> dict );
353- pctxt -> dict = NULL ;
354- }
355- if (dict != NULL ) {
356- pctxt -> dict = dict ;
357- xmlDictReference (pctxt -> dict );
358- #ifdef WITH_XSLT_DEBUG
359- xsltGenericDebug (xsltGenericDebugContext ,
360- "Reusing dictionary for document\n" );
361- #endif
362- }
363- // htmlCtxtUseOptions(pctxt, options | HTML_PARSE_RECOVER | HTML_PARSE_NOERROR );
364- inputStream = xmlLoadExternalEntity ((const char * ) URI , NULL , pctxt );
365- if (inputStream == NULL ) {
366- xmlFreeParserCtxt (pctxt );
367- return (NULL );
368- }
369- inputPush (pctxt , inputStream );
370- if (pctxt -> directory == NULL )
371- pctxt -> directory = xmlParserGetDirectory ((const char * ) URI );
372-
373- htmlDoRead (pctxt , NULL , NULL , options | HTML_PARSE_RECOVER , 1 );
374-
375- if (pctxt -> wellFormed ) {
376- doc = pctxt -> myDoc ;
377- }
378- else {
379- doc = NULL ;
380- xmlFreeDoc (pctxt -> myDoc );
381- pctxt -> myDoc = NULL ;
382- }
383- xmlFreeParserCtxt (pctxt );
384-
385- return (doc );
386- }
318+ }
0 commit comments