|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XSL/XML using Netscape 7
I need HELP!
For a prototype, I created a sample web page using XML, XSL, Tomcat, and Netscape 7. The idea is to view the transformation of XML and XSL in a Netscape 7 browser....this shouldn't be that difficult. So, I've created a Servlet that returns XML data where the stylesheet reference looks like this: <?xml version="1.0" ?><?xml-stylesheet type="text/xml" href="http://localhost:8080/appname/main/student.xsl"?> I believe the important points of the xsl file are: <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40"> <xsl:output method="html" /> At this point, Netscape only shows the XML data. It doesn’t seem to know where the XSL file is located. If I take the href value above (URL) and place it in the browser, the XSL page displays as it should. So, why doesn’t the transformation occur? This has to be a simple change….I hope. Thanks, Chris |
|
#2
|
|||
|
|||
|
Mozilla and Mozilla based browsers are realy picky about mime type that web server is returning to the browser. If mime type isn't right then browser won't display your xml file like you wish.
Read more about that here http://www.mozilla.org/newlayout/xml/#xhtml. By the way, whay are you using Tomcat for this? This example is working for me in Mozilla/NS. Code:
<!-- XML File sort.xml --> <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="sort.xsl"?> <Root> <F Items="123"/> <F Items="34"/> <F Items="187"/> <F Items="905"/> <F Items="1050"/> <F Items="903"/> <F Items="870"/> <F Items="515"/> <F Items="15"/> </Root> <!-- XSL File sort.xsl--> <?xml version='1.0' encoding='UTF-8'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="Root"> <html><head> <title>Sorting</title> </head> <body> <xsl:for-each select="F"> <xsl:sort select="@Items" data-type="number" order="descending" /> <xsl:if test="position() < 6"> <xsl:value-of select="@Items"/><br /> </xsl:if> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> I simply open Netscape an go to http://localhost:8080/sort.xml
__________________
Best regards Darren |
|
#3
|
|||
|
|||
|
First off...thanks for replying.
I'll answer your question. The reason for using tomcat, is that I'm trying to simulate a solution using XML. There are two servers in the equation. Server One (Using Tomcat) will request information from Server Two (Using Weblogic). Server Two will respond sending XML. I would like to have Server One take the XML and use an XSL stylesheet to create the proper presentation. **The XML is dynamic in the data being retrieved. I can't simply have an xml and xsl file sitting conveniently in the same location. Here is the mime setting I'm using in Tomcat: <mime-mapping> <extension>xml</extension> <mime-type>text/xml</mime-type> </mime-mapping> Still not working, Chris |
|
#4
|
|||
|
|||
|
I have mime-type as text/xml for both xml and xsl files. You could try that.
Since I'm not a Tomcat expert I'll let others jump in and fix this. Sorry I couldn't help. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL/XML using Netscape 7 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|