I finally got the dynamic path working for the xslt (like
projectteam2fo.xsl):
I use Eclipse as an IDE so what I ended up doing was:

Placed the following in the build/classes folder
-->  /xml/xslt/phonelist2fo.xsl
So what I ended up with is a structure:
/workspace/PhoneList/build/classes/xml/xslt/phonelist2fo.xsl

My servlet code contains:

String xslpath = getInitParameter("xslpath");
InputStream is = this.getClass().getResourceAsStream(xslpath);

My web.xml is:
<servlet>
    <display-name>PLServlet</display-name>
        <servlet-name>PLServlet</servlet-name>
        <servlet-class>embedding.PLServlet</servlet-class>
        <init-param>
            <param-name>xslpath</param-name>
            <param-value>/xml/xslt/phonelist2fo.xsl</param-value>
        </init-param>
   </servlet>

   <servlet-mapping>
      <servlet-name>PLServlet</servlet-name>
      <url-pattern>/PLServlet</url-pattern>
   </servlet-mapping>

When I publish the .war file to tomcat it ended up as:
/webapps/PhoneList/WEB-INF/classes/xml/xslt/phonelist2fo.xsl

This means that you have to change the parameter type of the second paramter
of the convert methods to InputStream rather than File.  The Transformer
class accepts InputStream as well as file for the second parameter.

convertPhoneList2PDF(PhoneList team, InputStream xslt, ByteArrayOutputStream
out, HttpServletResponse response) 

Calvin
--
View this message in context: 
http://www.nabble.com/Location-of-xsltfile-t1617801.html#a4442857
Sent from the FOP - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to