cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: XSLTProcessor patch, etc...
Date Wed, 26 Apr 2000 23:03:04 GMT
I think that would be really useful. After all, we regularly hear requests 
for a simple way of doing this. If security is a concern, it would be simple 
to add an option to cocoon.properties to switch this facility on and off.

Of course in the long term, it would be good to have fine-grained control, 
in the Cocoon 2 sitemap - i.e. specifying this option only for individual 
files or directories.

If you wanted to validate the stylesheet parameter you'd still have to use 
XSP or something, but that makes sense - validation is potentially a can of 
worms. (For example, I can think of one particular case I'm hoping to 
implement - user-defined stylesheets! [Yes, I will restrict what the user 
can do.] With that, it could not necessarily be validated against a static 
list, so better to write special code for that.)


Lee Burgess <lefty@red-bean.com> wrote:

[snip]

>Also, In spite of Mike's suggestion to use XSP for specifying
>alternate XSLs in the request, I went into XSLTProcessor.java and
>tweaked a couple lines.  The diff is below.  It is rough; but it
>works as long as you specify the absolute file path to the XSL you
>want to use, rather than the one indicated in the XML:
>
>http://www.myhost.org/test.xml?xsl=/home/lefty/foo.xsl
>
>Mainly, I did this just for kicks and giggles.  However, I think it's
>a feature that Cocoon could use.  It seems simpler to me: better to
>have 7 (or so) extra lines of code in the application than asking
>people to come up with various XSP or Producer implementations.
>
>Can it be (improved and) rolled in?
>
>-- cut here --
>Index: XSLTProcessor.java
>===================================================================
>RCS file: 
>/home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xslt/XSLTProcessor.java,v
>retrieving revision 1.11
>diff -u -r1.11 XSLTProcessor.java
>--- XSLTProcessor.java	2000/04/14 17:15:45	1.11
>+++ XSLTProcessor.java	2000/04/26 21:10:29
>@@ -170,7 +170,13 @@
>              if ((o != null) && (!this.hasChanged(request))) {
>                  return (Document) o;
>              } else {
>-                Document sheet = getDocument(resource);
>+	      Document sheet = null;
>+	      if (request.getParameter("xsl") != null) {
>+		sheet = getDocument(request.getParameter("xsl"));
>+	      }
>+	      else {
>+                sheet = getDocument(resource);
>+	      }
>                  this.store.hold(resource, sheet);
>                  this.monitor.watch(Utils.encode(request), resource);
>                  return sheet;
>@@ -195,4 +201,4 @@
>      public String getStatus() {
>          return "XSLT Processor";
>      }
>-}
>\ No newline at end of file
>+}
>-- cut here --
>
>--
>Lee P. W. Burgess  <<!>>  The first rule of Lefty is: you do not talk
>Programmer         <<!>>  about Lefty.
>Red Bean Software  <<!>>  The second rule of Lefty is: YOU DO NOT TALK
>lefty@red-bean.com <<!>>  ABOUT LEFTY.
>
>
>
>
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message