You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Jeffrey Owens <jo...@yahoo.com> on 2002/06/18 19:59:53 UTC
using xsl in jsp portlet
I am accessing a java class on another server and returning xml. I want to use xsl to transform xml into html, but I cant' get jsp to recognize stylesheet, within the jsp or the xreg file. I'm probably going at this backward and need to reengineer my whole approach, but if anyone has any ideas I'd appreciate comment.
Jeffrey Owens
---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup
Re: using xsl in jsp portlet
Posted by Jim Schultz <js...@neb.rr.com>.
We have been able to parse an XML feed from an outside source
(YellowBrix) with the following JSP code:
<%@ page language="java" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.net.URL" %>
<%@ page import="javax.xml.transform.*"%>
<%@ page import="javax.xml.transform.stream.*"%>
<html>
<body>
<%
String link = "http://...your external link here...";
URL url = new URL(link);
InputStream f = url.openStream();
String xslFile = "news.xsl";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new
StreamSource(xslFile));
transformer.transform( new StreamSource(f), new StreamResult(out));
%>
</body>
</html>
I didn't want to spend all day trying to make Jetspeed happy with the
path to the stylesheet, so I set up the JSP, ran it and checked the
error for the path in the "news.xml not found" message. In our case, it
was looking in the WEB-INF/conf directory but I can't tell you exactly
why it's looking there. Your instance may look elsewhere depending on
configuration settings.
Jim Schultz
Jeffrey Owens wrote:
>I am accessing a java class on another server and returning xml. I want to use xsl to transform xml into html, but I cant' get jsp to recognize stylesheet, within the jsp or the xreg file. I'm probably going at this backward and need to reengineer my whole approach, but if anyone has any ideas I'd appreciate comment.
>
>
>
>
>Jeffrey Owens
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: using xsl in jsp portlet
Posted by Glen Carl - CSC <ca...@csc-monterey.com>.
Did you try transforming the XML/XSL to html first, and then inserting
this html into the JSP? Check out XSLPortlet for a start on the transform.
Jeffrey Owens wrote:
> I am accessing a java class on another server and returning xml. I want to use xsl to transform xml into html, but I cant' get jsp to recognize stylesheet, within the jsp or the xreg file. I'm probably going at this backward and need to reengineer my whole approach, but if anyone has any ideas I'd appreciate comment.
>
>
>
>
> Jeffrey Owens
>
>
> ---------------------------------
> Do You Yahoo!?
> Sign-up for Video Highlights of 2002 FIFA World Cup
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>