Re: [xslt] xlstproc from Ant - can't create directories using -o?



On Tue, Jan 07, 2003 at 10:54:42PM -0500, Craig Goss wrote:
> > Can you log this in bugzilla so I don't loose track of the issue.
> 
> Absolutely.  Bugzilla's misbehaving at the moment ... will try again in the
> morning.
> 
> > Adding a call to xsltCheckWrite() in xsltproc before calling
> > xsltSaveResultToFile() will probably be sufficient.
> 
> Yes, that works though I had to poke around a bit to discover where the save
> is invoked.  I expected it to be called directly from xsltProcess() but when
> the output variable is set there's a conditional that jumps past most of the
> process code and calls xsltRunStylesheetUser ... which eventually calls
> xsltSaveResultToFile().  There's probably a better way to do it, but the
> following hack temporarily takes care of the problem.

   Patch for the right fix enclosed:

paphio:~/XSLT/xsltproc -> ./xsltproc -o /foo/bar tst.xsl tst.xml
runtime error
xsltApplyStylesheet: saving to /foo/bar may not be possible
paphio:~/XSLT/xsltproc -> ls /tmp/foo
/bin/ls: /tmp/foo: No such file or directory
paphio:~/XSLT/xsltproc -> ./xsltproc -o /tmp/foo/bar tst.xsl tst.xml
paphio:~/XSLT/xsltproc -> ls /tmp/foo/bar
/tmp/foo/bar
paphio:~/XSLT/xsltproc ->

  this is fixed in CVS,
    thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: libxslt/transform.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/transform.c,v
retrieving revision 1.197
diff -c -r1.197 transform.c
*** libxslt/transform.c	11 Dec 2002 17:53:37 -0000	1.197
--- libxslt/transform.c	8 Jan 2003 11:33:19 -0000
***************
*** 3802,3807 ****
--- 3802,3821 ----
  	xmlFreeDoc(res);
  	res = NULL;
      }
+     if ((res != NULL) && (ctxt != NULL) && (output != NULL)) {
+ 	int ret;
+ 
+ 	ret = xsltCheckWrite(userCtxt->sec, userCtxt, output);
+ 	if (ret == 0) {
+ 	    xsltTransformError(ctxt, NULL, NULL,
+ 		     "xsltApplyStylesheet: forbidden to save to %s\n",
+ 			       output);
+ 	} else if (ret < 0) {
+ 	    xsltTransformError(ctxt, NULL, NULL,
+ 		     "xsltApplyStylesheet: saving to %s may not be possible\n",
+ 			       output);
+ 	}
+     }
  
      if ((ctxt != NULL) && (userCtxt == NULL))
  	xsltFreeTransformContext(ctxt);


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