Re: [xslt] document('') with xsltParseStylesheetDoc()



On Fri, 20 Jul 2001, Matt Sergeant wrote:

> On Fri, 20 Jul 2001, Matt Sergeant wrote:
>
> > I can't get document('') to work when I'm using xsltParseStylesheetDocu().
> > It works absolutely fine when using xsltParseStylesheetFile(), because it
> > has the filename.
>
> Found a fix. Checking it's safe now, will send a patch if it is.

Seems sound. Attached.

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\
--- libxslt/functions.c.old	Fri Jul 20 14:58:13 2001
+++ libxslt/functions.c	Fri Jul 20 14:58:22 2001
@@ -179,14 +179,19 @@
 			"document() : internal error tctxt == NULL\n");
 		valuePush(ctxt, xmlXPathNewNodeSet(NULL));
 	    } else {
-		doc = xsltLoadDocument(tctxt, URI);
-		if (doc == NULL)
-		    valuePush(ctxt, xmlXPathNewNodeSet(NULL));
-		else {
-		    /* TODO: use XPointer of HTML location for fragment ID */
-		    /* pbm #xxx can lead to location sets, not nodesets :-) */
-		    valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc->doc));
-		}
+                if (xmlStrEqual(tctxt->style->doc->URL, URI)) {
+                    valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr)tctxt->style->doc));
+                }
+                else {
+		    doc = xsltLoadDocument(tctxt, URI);
+		    if (doc == NULL)
+		        valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+		    else {
+		        /* TODO: use XPointer of HTML location for fragment ID */
+		        /* pbm #xxx can lead to location sets, not nodesets :-) */
+		        valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc->doc));
+		    }
+                }
 	    }
 	    xmlFree(URI);
 	}


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