I have a simple struts 2 app as follows:

 

1 x ActionSupport Class which simply fills a its own parameters ( a
couple of strings )

 

I am then trying to render the ActionSupport class as xml using the
following xsl

 

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >

    <xsl:template match="result">

    <html>

    <body>

            <table border="1">

            <tr bgcolor="#9acd32">

            <th align="left">Name</th>

            <th align="left">Desc</th>

            <th align="left">Price</th>

            <th align="left">Sup Name</th>

            </tr>

    

            <tr>

            <td><xsl:value-of select="/result/name"/></td>

            <td><xsl:value-of select="/result/description"/></td>

            <td><xsl:value-of select="/result/price"/></td>

            <td><xsl:value-of select="/result/supplier/name"/></td>

            </tr>

            </table>

    </body>

    </html>

    </xsl:template>

</xsl:stylesheet>

 

My struts config is as follows:

 

<struts>  

     <package name="struts2demo" extends="struts-default">  

         <action name="XSL" class="struts2demo.login.action.Product">

            <result name="success" type="xslt">

                        <param
name="stylesheetLocation">/Product.xsl</param>

            </result>

            </action>

     </package>  

</struts>  

 

Now I am assuming that this should give me an Xhtml page that will be
rendered by most browsers

All works fine until I go to view the action via a web browser

 

Basically I get a message in the web browser that tells me :

 

This XML file does not appear to have any style information associated
with it. The document tree is shown below.

 

If i right click and look at the source for the pafge i get:

 

<html>

<body>

<table border="1">

<tr bgcolor="#9acd32">

<th align="left">Name</th><th align="left">Desc</th><th
align="left">Price</th><th align="left">Sup Name</th>

</tr>

<tr>

<td>Epson</td><td>Super printer</td><td>12.34</td><td>Online Business
Ltd.</td>

</tr>

 

</table>

</body>

</html>

 

It looks ok so I can't understand what the issue is??? Does this mean i
somehow have to embed the Product.xsl in the resulting

page??

 

Any help appreciated

 

Regards

 

Mark

      

Reply via email to