aspose file tools*
The moose likes XML and Related Technologies and the fly likes Reg XSLT View in Browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Reg XSLT View in Browser" Watch "Reg XSLT View in Browser" New topic
Author

Reg XSLT View in Browser

Karne Reddy
Ranch Hand

Joined: May 28, 2006
Posts: 35
Hi Friends,

Can anybody help me out in viewing or applying an xslt to a xml document.

Here is my xslt code.


<?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>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td>.</td>
<td>.</td>
</tr>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>


And I applied the above xslt doc to the following xml file
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
<?xml-stylesheet type=�text/xsl� href="employees.xsl�?>
<employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.employees.com/a employees.xsd" xmlns="http://www.employees.com/a">
<!-- <?xml-stylesheet type=�text/css� href="emp.css�?> -->


<employee position="manager">
<name>
<first>John</first>
<last>Dent</last>
</name>
<age>34</age>
</employee>

....


</employees>

In the browser I am not able to see the expected result.
I am getting the following thing in browser:

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)
-->
<?xml-stylesheet type=�text/xsl� href="employees.xsl�?>
- <employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.employees.com/a employees.xsd" xmlns="http://www.employees.com/a">
- <!-- <?xml-stylesheet type=�text/css� href="emp.css�?>
-->
- <employee position="manager">
- <name>
<first>John</first>
<last>Dent</last>
</name>
<age>34</age>
</employee>

</employees>

Can anybody explain wat might be the reason?


----------
scjp, scwcd


asdfa
vinay kumar
Ranch Hand

Joined: Sep 23, 2006
Posts: 31
No problem with the files except double quotes character (might be an editor problem in which you have typed in).

I replaced � with ". Opened in IE. Displayed a table with the given header colours.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reg XSLT View in Browser