Got everything working finally... Now XSP is transformed with
logicsheet, the result is compiled and the resulting XML is transformed
to HTML using style template. Nice.

The problem was that file.getCanonicalPath() in
CocoonRenderer.transform() returned the path of the file, not the path
of the directory the file was in. I changed it into
file.getParentFile().getCanonicalPath() + "/".

There are still issues, though:
Paths that are relative to the current document are resolved correctly,
the path is simply added to the path of the original file requested.
However, when you reference a stylesheet relative to the virtual root
and jetspeed is running under separate context, then the mapping fails.
Examples:
1.
XML file, physical path: webapps/jetspeed/test.xml
XML file, virtual path: /jetspeed/test.xml
stylesheet reference: myStyle.xsl
resolved correctly: webapps/jetspeed/myStyle.xsl
2.
XML file, physical path: webapps/jetspeed/test.xml
XML file, virtual path: /jetspeed/test.xml
stylesheet reference: /otherdir/myStyle.xsl
resolved incorrectly: webapps/jetspeed/otherdir/myStyle.xsl

The filename mapping in Cocoon 1.* is also a hack, so we probably cannot
get it working properly before Cocoon 2.
The current solution is working, as long as you don't try to reference
your stylesheets absolute to the virtual root of your site while
jetspeed itself is running in separate context under the root.
If jetspeed would be running in root context, everything could work...
not sure, though. Someone needs to test this.

The diff is together with the other patch that I submitted earlier... is
it the same file so I don't know which file should I take as basis, the
original or patched...

Neeme

Index: CocoonRenderer.java
===================================================================
RCS file:
/products/cvs/jetspeed/jetspeed/src/java/org/apache/jetspeed/portal/coco
on/CocoonRenderer.java,v
retrieving revision 1.21
diff -r1.21 CocoonRenderer.java
113c113
<         String stylesheet_pi = "<?xml-stylesheet href=\"" + stylesheet
+ "\" type=\"text/xsl\"?>";
---
>         boolean stripExistingPIs = (stylesheet != null);
115c115
<         SAXPIFilter filter = new SAXPIFilter( new PrintWriter(bos),
true );
---
>         SAXPIFilter filter = new SAXPIFilter( new PrintWriter(bos),
stripExistingPIs );
121c121
<         String fileName = file.getCanonicalPath();
---
>         String fileName = file.getParentFile().getCanonicalPath() +
"/";
134c134,138
<         pis.append( stylesheet_pi + "\n");
---
>         if (stylesheet != null)
>         {
>             String stylesheet_pi = "<?xml-stylesheet href=\"" +
stylesheet + "\" type=\"text/xsl\"?>";
>             pis.append( stylesheet_pi + "\n");
>         }



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to