PDA

Click to See Complete Forum and Search --> : Displaying Applet with XSLT Problem


GamerMax5
Oct 15th, 2006, 04:35 PM
I'm back with another problem with applets. This time, I'm having trouble displaying applets with XSLT. See I'm usually using an HTML-only page to test my applet out on (I don't like using the applet viewer). Anywho, since I'm trying to get away from making HTML-only pages and using XML technologies instead so I decided to use and XML file transformed by XSLT to display my applet. Well the HTML-only page runs the applet smoothly. The XML file tells me that the applet isn't "inited" and doesn't display it. Can someone give me a hand? I'll display my XML/XSLT code below.

XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="MonopolyMain.xsl"?>
<monopolyMain>
<gameFrame>
<codeSource>
MonopolyMain.class
</codeSource>
<frameWidth>
430
</frameWidth>
<frameHeight>
430
</frameHeight>
<frameAlignment>
center
</frameAlignment>
</gameFrame>
</monopolyMain>

XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<applet code="{gameFrame/codeSource}" width="{gameFrame/frameWidth}" height="{gameFrame/frameHeight}"></applet>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Thanks in advance!

CornedBee
Oct 15th, 2006, 07:13 PM
Which browser?
Have you checked the generated HTML in a standalone transformer? Does it look correct? If it does, it would be a problem of the browser transforming the XML.

Also, <applet> is an outdated and deprecated method of doing a Java applet, with generally a high chance of failing in IE. Use <object> with the right clsid instead.

ComputerJy
Oct 16th, 2006, 12:06 AM
It worked fine on IE 7 RC1, but nothing showed up on FF. Just a blank page with an empty applet tag, no attributes set

GamerMax5
Oct 17th, 2006, 08:30 AM
Also, <applet> is an outdated and deprecated method of doing a Java applet, with generally a high chance of failing in IE. Use <object> with the right clsid instead.

Thanks for the update. I don't like using deprecated code.

In regards to <object>, mainly the clsid, how do you obtain that? Is that a randomly generated GUID?

CornedBee
Oct 17th, 2006, 08:56 AM
No, it's not random, it's fixed for the Java plugin. No idea what exactly, but a Google search should provide the info.

GamerMax5
Oct 17th, 2006, 04:26 PM
Okay I found out information about the clsid and implemented a very simple object tag that I saw that worked fine in HTML. I modified the XML and XSLT sheets and here's what I have so far:

XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="MonopolyMain.xsl"?>
<monopolyMain>
<gameFrame>
<codeSource>
MonopolyMain.class
</codeSource>
<frameWidth>
430
</frameWidth>
<frameHeight>
430
</frameHeight>
<jPlugInClsId>
clsid:8AD9C840-044E-11D1-B3E9-00805F499D93
</jPlugInClsId>
</gameFrame>
</monopolyMain>

XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<object classid="{gameFrame/jPlugInClsId}" width="{gameFrame/frameWidth}" height="{gameFrame/frameHeight}">
<param name="code" value="{gameFrame/codeSource}" />
</object>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

The browser (IE6SP1) parses both correctly, and all my plugins are up to date, so I'm starting to think it's IE itself. The applet still isn't loading.

ComputerJy
Oct 17th, 2006, 05:21 PM
I tried it on a newer version and it didn't work
take a look at this page http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/using_tags.html

GamerMax5
Oct 17th, 2006, 09:07 PM
That's the page I had looked at previously. I read over the information again and still the applet will not show. T_T

CornedBee
Oct 18th, 2006, 01:38 AM
Does it show if you directly load an HTML file containing the conversion result? If yes, then it's a bug with IE's XML/XSLT handling. (Wouldn't surprise me.) If no, check your Java installation.

GamerMax5
Oct 27th, 2006, 09:50 PM
Does it show if you directly load an HTML file containing the conversion result? If yes, then it's a bug with IE's XML/XSLT handling. (Wouldn't surprise me.) If no, check your Java installation.

Yeah it displayed.

Is there a browser other than IE, Firefox, and Opera, or an application that I can use to see my XML pages that doesn't use up a crap load of memory because that's something that I can't really spare (at only 192MB, WMP kills me T_T and yes it's an old computer with Win2K) and doesn't have IE defects in it? Or will I have to use the memory consuming Firefox?